1 Reply Latest reply on Nov 7, 2012 2:24 PM by Wolf-Dieter Fink

    [AS7.1.1] EJB JNDI Lookup confusion: remote vs local

    Philipp Nanz Newbie

      Hi all,


      I have read the docs regarding remote JNDI lookup, but somehow it doesn't seem to match my first-hand experiences. I hope someone can clear this up for me.


      My application basically looks like this:



      -- service.jar (EJB JAR)

      -- web.war


      Additionally, there is an remote client talking the app using EJB remoting...



      1) Local JNDI lookup (used inside the JAR and partially in the WAR):


      JNDI name: java:global/Business/service/FooEJB!foo.bar.ServiceLocal


      This works nicely, always.


      2) Remote JNDI lookup, from within the WAR:

      InitialContext is basically empty in this scenario.


      JNDI name: ejb:Business/service/FooEJB!foo.bar.Service


      This works as well, but there are two strange(?) differences compared to the local lookup:

      The prefix must be 'ejb:', 'java:' doesn't work. Also it doesn't work with 'global/' (or any other scope). Ok, I admit, this may be a remote thing, but still I'm wondering...


      3) Remote JNDI lookup, from external application:







      JNDI name: java:Business/service/FooEJB!foo.bar.Service


      Now it's getting crazy. This works as well, but as you see I need to use 'java:' prefix. With 'ejb:' prefix I get the dreaded NameNotFoundException



      Can anyone make any sense of this?!


      Thanks in advance!