Hi, could you have a look at your server log file, there should be some outputs for ejb jndi names like below :
2011-07-25 14:31:22,250 INFO [startup] Jndi(name=MEJBRemoteHome) --> Ejb(deployment-id=geronimo-mejb-3.0-SNAPSHOT.jar/MEJB) 2011-07-25 14:31:22,250 INFO [startup] Jndi(name=global/geronimo-mejb-3.0-SNAPSHOT/MEJB!javax.management.j2ee.ManagementHome) --> Ejb(deployment-id=geronimo-mejb-3.0-SNAPSHOT.jar/MEJB) Thanks. 2013/5/5 Philippe Marschall <[email protected]> > Hi > > I'm trying to use remote EJBs and am running into some problems. I > followed the instructions at [1]. I use version 4.5.2 of the openejb-client > (the latest I could find in Maven Central) and Geronimo 3. My code looks > like this: > > String jndiName = > "java:global/osgi-remoting-**ejb-sample-ear/osgi-remoting-** > ejb-sample-ejb/StatelessBean!**com.github.marschall.jboss.** > osgi.remoting.ejb.sample.**StatelessRemote1"; > > Properties p = new Properties(); > p.put("java.naming.factory.**initial", "org.apache.openejb.client.** > RemoteInitialContextFactory"); > p.put("java.naming.provider.**url", "ejbd://localhost:4201"); > > InitialContext ctx = new InitialContext(p); > > Object myBean = ctx.lookup(jndiName); > > The exception I get is: > > Exception in thread "main" javax.naming.**NotContextException: > openejb/remote/global/osgi-**remoting-ejb-sample-ear/osgi-** > remoting-ejb-sample-ejb/**StatelessBean!com.github.** > marschall.jboss.osgi.remoting.**ejb.sample.StatelessRemote1 > at org.apache.xbean.naming.**context.AbstractContext.** > lookup(AbstractContext.java:**165) > at org.apache.xbean.naming.**context.AbstractContext.** > lookup(AbstractContext.java:**605) > at org.apache.geronimo.openejb.**DeepBindableContext$** > ContextWrapper.lookup(**DeepBindableContext.java:97) > at org.apache.openejb.server.**ejbd.JndiRequestHandler.** > doLookup(JndiRequestHandler.**java:203) > at org.apache.openejb.server.**ejbd.JndiRequestHandler.** > processRequest(**JndiRequestHandler.java:142) > at org.apache.openejb.server.**ejbd.EjbDaemon.** > processJndiRequest(EjbDaemon.**java:238) > at org.apache.openejb.server.**ejbd.EjbDaemon.service(** > EjbDaemon.java:167) > at org.apache.openejb.server.**ejbd.EjbServer.service(** > EjbServer.java:71) > at org.apache.openejb.server.**ejbd.KeepAliveServer$Session.** > service(KeepAliveServer.java:**213) > at org.apache.openejb.server.**ejbd.KeepAliveServer.service(** > KeepAliveServer.java:233) > at org.apache.openejb.server.**ejbd.EjbServer.service(** > EjbServer.java:66) > at org.apache.openejb.server.**ServicePool$2.run(ServicePool.** > java:91) > at org.apache.openejb.server.**ServicePool$3.run(ServicePool.** > java:120) > at java.util.concurrent.**ThreadPoolExecutor.runWorker(** > ThreadPoolExecutor.java:1110) > at java.util.concurrent.**ThreadPoolExecutor$Worker.run(** > ThreadPoolExecutor.java:603) > at java.lang.Thread.run(Thread.**java:722) > > I double checked the JNDI name and I believe it is correct: > > - The application is deployed as an .ear with an single ejb.jar. The ear > is called osgi-remoting-ejb-sample-ear-**0.2.0-SNAPSHOT.ear but has a > META-INF/application.xml with <application-name>osgi-** > remoting-ejb-sample-ear</**application-name> > > - The ear seems to have deployed successfully as I see the following in > the console > > Started Application Modules: > EAR: default/osgi-remoting-ejb-**sample-ear-0.2.0-SNAPSHOT/** > 1366917167252/car > > - The ejb jar is in the root of the ear and called > osgi-remoting-ejb-sample-ejb.**jar. There is ejb-jar.xml in the ejb jar. > > - The EJB is called com.github.marschall.jboss.**osgi.remoting.ejb.sample. > **StatelessBean and annotated with @Stateless but not with @Remote > annotation. It implements an interface called com.github.marschall.jboss.* > *osgi.remoting.ejb.sample.**StatelessRemote1 which is annotated with > @Remote. > > - The Oracle tutorial seems to use "/" to denote the fully qualified > interface names but as far as I can see from chapter 4.4 of the EJB spec it > should be "!" > > [1] > http://tomee.apache.org/**clients.html<http://tomee.apache.org/clients.html> > [2] > http://docs.oracle.com/javaee/**6/tutorial/doc/gipjf.html<http://docs.oracle.com/javaee/6/tutorial/doc/gipjf.html> > > Cheers > Philippe > -- Ivan
