4 Replies Latest reply on May 3, 2013 9:31 AM by jaikiran pai

    Problem with local EJB JNDI lookup

    A H Newbie

      Hi,

       

      I'm using JBoss AS 7.1.2.

       

      I've a local EJB as follows:

       

      @Local
      public interface IBenutzerServiceIntern {
      
      @Stateless
      public class BenutzerServiceIntern extends AbstrakterPersistenzService implements IBenutzerServiceIntern {}
      
      

       

      JBoss AS 7 tells me that the EJB is available under the following JNDI names:

      java:global/sd01_persistenz/sd.server.persistenz.impl/BenutzerServiceIntern!com.example.sd.persistenz.services.benutzer.IBenutzerServiceIntern
      java:app/sd.server.persistenz.impl/BenutzerServiceIntern!com.example.sd.persistenz.services.benutzer.IBenutzerServiceIntern
      java:module/BenutzerServiceIntern!com.example.sd.persistenz.services.benutzer.IBenutzerServiceIntern
      java:global/sd01_persistenz/sd.server.persistenz.impl/BenutzerServiceIntern
      java:app/sd.server.persistenz.impl/BenutzerServiceIntern
      java:module/BenutzerServiceIntern
      

       

      I try to perform a JNDI lookup within the same module as follows:

       

      public class Konverter {
       static {
        try {
         InitialContext.doLookup("java:module/BenutzerServiceIntern");
        } catch (final NamingException e) {
         e.printStackTrace();
        }
      }
      

       

      When this code is executed on server startup, I get the following error:

       

      When this code is executed, I get the following error:

      javax.naming.NameNotFoundException: java:module/BenutzerServiceIntern
       at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:127)
       at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at javax.naming.InitialContext.doLookup(InitialContext.java:265)
       at com.example.sd.persistenz.konverter.Konverter.<clinit>(Konverter.java:51)
      
      

       

      Anybody got an idea why this fails?