1 Reply Latest reply on May 8, 2014 3:53 AM by wdfink

    JBoss EAP 6.1 EJB Remote lookup

    marcusdidiusfalco

      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?

        • 1. Re: JBoss EAP 6.1 EJB Remote lookup
          wdfink

          Hi Hans-Michael,

           

          1. and 2.) The name in unified and this is what you see during deployment, the client is a different story

          here ejb: is used to state that the target is an ejb.

           

          3.) Documentation is here:

          Community JBoss AS 7.2

          EAP Download https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/

          And you can use several quickstarts which can be found on github or as download from the customer portal.

           

           

          BTW your lookup is wrong as "app/*" can only be used inside the same EAR file.

          As you deployed a jar you need to use:

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

          or

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

          notice the // which is not necessary as you don't use a (JBoss specific)  distinct name