I'm having the following issue. An application written for JBoss tries to refer to its beans when locating them through JNDI using the following pattern:
ctx = new InitialContext(System.getProperties()); ctx.addToEnvironment("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); ctx.addToEnvironment("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); ctx.addToEnvironment("java.naming.provider.url", "localhost:1099"); FooBean = (FooBean) ctx.lookup("PROJECTNAME/FooBean/remote");
FooBean = (FooBean) ctx.lookup("FooBean/remote");
14:10:13,159 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer 14:10:13,168 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=PROJECTNAME.jar,name=FooBean,service=EJB3 with dependencies: 14:10:13,342 INFO [EJBContainer] STARTED EJB: com.foo.bar.FooBean ejbName: FooBean
by default the archive name is not included as part of the jndi name UNLESS it's an EAR. so, if you package your JAR in an EAR, then the jndi lookup will include the EAR name.