I have an EAR app with an ejb module inside and SomeService:
some-ear.ear -> some-ejb.jar -> SomeBean implements ISomeBean
In Java EE specification I see that the JNDI name of this bean should be
java:comp/env/ISomeService
when I deploy my app on WebLogic 10.3 then new InitialContext().lookup("java:comp/env/ISomeService"); works well
Now I deploy this app on JBoss 4.2.3 and I see the following in the log:
DEBUG [org.jboss.ejb3.stateless.BaseStatelessProxyFactory] Binding proxy for SomeBean in JNDI at some-ear/SomeBean/local
OMG! JNDI name of my bean is some-ear/SomeBean/local and
new InitialContext().lookup("java:comp/env/ISomeService"); – not working
new InitialContext().lookup("some-ear/SomeBean/local"); – works well
Now I deploy my app on GlassFish 3.1 and I see the following in the log:
Portable JNDI names for EJB SomeBean : [java:global/some-ear/some-jar/SomeBean ...
Again new JNDI name!
new InitialContext().lookup("java:global/some-ear/some-jar/SomeBean"); – works well
Can you explain to me why on different AS different JNDI names exist of the same bean and why this JNDI name is different with Java EE specification?
The JavaEE naming chaos was a long time issue until JavaEE6 spec addressed it. Now we have standard namespaces for various components of Java EE AppServer. To be fair, you should compare Java EE 6 AppServers, like JBossAS7, Websphere 8, Glassfish 3.1.