Hello
I am trying to build an EJB ECP Client, I already installed the OpenEJB OSGi
Bundle and add it to my RCP app dependencies but when i the application
reaches the JNDI lookup it fails.
My EJB Caller class is:
public class EjbCaller {
static InitialContext ctx;
static TestBeanRemote testBean;
public static void init() throws Exception {
Properties props = new Properties();
System.out.println("init");
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
ctx = new InitialContext(props);
testBean = (TestBeanRemote)ctx.lookup("TestBeanRemote");
System.out.println(testBean.toString());
}
public static String hello(String msg) throws Exception {
init();
return testBean.sayHello(msg);
}
}
I am calling the hello method from an RCP Action as follows:
EjbCaller.hello("rcp");
When I execute the test step by step it gives me first:
2010-02-18 09:09:41,064 ERROR [remote] "null OEJ/0.0" FAIL "Unexpected error
- For input string: "/""
java.lang.NumberFormatException: For input string: "/"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at
org.apache.openejb.client.ProtocolMetaData.init(ProtocolMetaData.java:56)
at
org.apache.openejb.client.ProtocolMetaData.readExternal(ProtocolMetaData.java:92)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:103)
at org.apache.openejb.server.ejbd.EjbDaemon.service(EjbDaemon.java:84)
at org.apache.openejb.server.ejbd.EjbServer.service(EjbServer.java:60)
at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:78)
at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:101)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
After that another exception:
Apache OpenEJB 3.1.1 build: 20090530-06:18
http://openejb.apache.org/
INFO - openejb.home = C:\Documents and Settings\mohamed\openejb
INFO - openejb.base = D:\Eclipse
Workspaces\PersologicJ2EE\.metadata\.plugins\org.eclipse.pde.core\persologicRCP.application\org.eclipse.osgi\bundles\47\1\.cp
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Using 'openejb.deployments.classpath=false'
java.lang.RuntimeException: Invalid response from server: -1
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:292)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.hbtech.EjbCaller.init(EjbCaller.java:26)
at com.hbtech.EjbCaller.hello(EjbCaller.java:31)
at callejb.views.MyEjbView$2.run(MyEjbView.java:143)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:583)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:500)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:452)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3823)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3422)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at persologicrcp.Application.start(Application.java:20)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Remark: If i make a test with a standalone java client it works fine.
Thanks for help
--
View this message in context:
http://n4.nabble.com/RCP-Client-for-EJB-tp1559802p1559802.html
Sent from the OpenEJB User mailing list archive at Nabble.com.