cancel
Showing results for 
Search instead for 
Did you mean: 

Java Bean Model in WebDynpro

Former Member
0 Kudos

Hi,

I have build am Java Bean Class which I use in a WebDynpro Model. In this Java Bean Class i want to call a remote method via RMI.

public String calculate(int aFirst, int aSecond)

{

float theResult = 0;

try {

Properties p = new Properties();

p.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");

p.put(Context.PROVIDER_URL, "nitse06u:50004");

p.put(Context.SECURITY_PRINCIPAL, "Administrator");

p.put(Context.SECURITY_CREDENTIALS, "admin");

Context initialContext = new InitialContext(p);

Object ob = initialContext.lookup("Calculator");

CalculatorHome home = (CalculatorHome) PortableRemoteObject.narrow(ob, CalculatorHome.class);

Calculator theCalculator = home.create();

theResult = theCalculator.add(aFirst, aSecond);

}

catch (Exception ex)

{

ex.printStackTrace();

}

return new Integer(((new Float(theResult))).intValue()).toString();

}

At runtime following exception occurred.

java.lang.NoClassDefFoundError: com.sap.examples.calculator.CalculatorHome

at com.sap.calculator.helper.CalculatorHelper.calculate(CalculatorHelper.java:109)

at caom.sap.webdynpro.CalculatorComponentView.onActionCalculate(CalculatorComponentView.java:150)

at caom.sap.webdynpro.wdp.InternalCalculatorComponentView.wdInvokeEventHandler(InternalCalculatorComponentView.java:144)

at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)

at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:100)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:299)

at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:635)

at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)

.....

How can I add the home and remote classes to my webdynpro?

Regards

Richard

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You could try to put the ejbClient.jar (the jar file that was generated in your ejb project) into the lib directory of your webdynpro project.

Everything in the lib directory is deployed with the Webdynpro application.

To see the lib directory you have to change to the navigator view in the IDE.

It is right under the Project root.

If you have Development Component Projects this is a different story. You can add the public part in your ejb DC (of type assembly) to the DC usages in the WebDynpro DC. The type assembly means then, that the jar file from the ejb project is taken and packaged with the WebDynpro DC. But watch out. For this to work you have to do a real DC build and a real DC deploy not the deploy and run function. Hope this helps.

Answers (0)