1 Reply Latest reply on May 8, 2014 3:53 AM by Wolf-Dieter Fink

    JBoss EAP 6.1 EJB Remote lookup

    Hans-Michael Rupp Novice

      Hello,

       

      I have a SLSB with Remote Interface. During deployment I get

       

      08:27:33,110 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeplo

      ymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean name

      d TheatreInfoBean in deployment unit deployment "ticket-agency-ejb.jar" are as f

      ollows:

       

              java:global/ticket-agency-ejb/TheatreInfoBean!com.packtpub.as7development.chapter3.ejb.TheatreInfo

              java:app/ticket-agency-ejb/TheatreInfoBean!com.packtpub.as7development.chapter3.ejb.TheatreInfo

              java:module/TheatreInfoBean!com.packtpub.as7development.chapter3.ejb.TheatreInfo

              java:jboss/exported/ticket-agency-ejb/TheatreInfoBean!com.packtpub.as7development.chapter3.ejb.TheatreInfo

              java:global/ticket-agency-ejb/TheatreInfoBean

              java:app/ticket-agency-ejb/TheatreInfoBean

              java:module/TheatreInfoBean

       

      I am writing a client application.

      I have

       

      /src/main/resources/jboss-ejb-client.properties

      remote.connections=default

      remote.connection.default.host=localhost

      remote.connection.default.port = 4447

      @Test

          public void test() throws NamingException{

              Properties properties = new Properties();

              properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

              InitialContext initialContext = new InitialContext(properties);

              TheatreInfo theatreInfo = null;

              theatreInfo = (TheatreInfo) initialContext.lookup("java:global/ticket-agency-ejb/TheatreInfoBean!com.packtpub.as7development.chapter3.ejb.TheatreInfo");

              assertNotNull(theatreInfo);

          }

       

      with that I get

      javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)

       

      Why do I get a NoInitialContxtEception?

       

      After some comparing different lookups from different articles and books and some trials I came up with

      theatreInfo = (TheatreInfo) initialContext.lookup("ejb:app/ticket-agency-ejb//TheatreInfoBean!com.packtpub.as7development.chapter3.ejb.TheatreInfo");

       

      1.) Why can't I use the standardized portable JNDI name as specified in JEE6? Is this behavior even allowed for a JEE6 compliant server?

      2.) Why is the JNDI which can be used not logged out during deployment?

      3.) Where is documentation which describes this behavior?