1 Reply Latest reply on Jan 22, 2004 5:38 PM by darranl

    Explanation of local JNDI name

    natebowler

       

      "natebowler" wrote:
      I can access a Local inteface on a Test EJB (stateless session) with the following DD and JSP code.

      test.ear
      +-test-web.war
      +------WEB-INF
      +--------------web.xml
      +------test.jsp
      |
      +-test-ejb.jar
      +------META-INF
      +--------------ejb-jar.xml
      +------<ejb classes>

      Contents of ejb-jar.xml:

      <session >
      <description><![CDATA[]]></description>
      <display-name>Test Methods Bean</display-name>
      <ejb-name>TestMethods</ejb-name>
      <home>com.attask.biz.TestMethodsHome</home>
      <remote>com.attask.biz.TestMethods</remote>
      <local-home>com.attask.biz.TestMethodsLocalHome</local-home>
      <local>com.attask.biz.TestMethodsLocal</local>
      <ejb-class>com.attask.biz.TestMethodsBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      </session>

      Contents of web.xml - nothing ejb-related (ejb-link, etc.)

      Contents of test.jsp

      Properties props = System.getProperties();
      InitialContext iniCtx = new InitialContext(props);
      Object obj = iniCtx.lookup("local/TestMethods");
      TestMethodsLocalHome home = (TestMethodsLocalHome) PortableRemoteObject.narrow(obj, TestMethodsLocalHome.class);
      TestMethodsLocal test = home.create();
      String echo = test.echo("WOo Hoo");


      My question is: How did this become "local/TestMethods"?

      The only way I found this is by removing the Remote interfaces and DD and looking in the logs for the deployed EJB/JNDI name on an only-local EJB.

      If I have both remote and local, I only see "TestMethods" in the logs. However, "TestMethods" can be used to get remote Home and "local/TestMethods" can be used to get local Home.

      Where is this documented? Is this a J2EE standard and implicit, or is this a JBoss-specific naming? If JBoss-specific, can this be changed?