1 Reply Latest reply on Feb 2, 2013 2:10 PM by wdfink

    javax.naming.NameNotFoundException: java:app/testcmp/Test!com.test.cmp.TestLocalHome

    srinivas.bijjam

      Enviroment

      JBoss Version: JBoss AS 7.2.0.Alpha1-SNAPSHOT

      EJB Version : 2.0

      Operating System:        Windows

      Startup Command: standalone.bat -c standalone-full.xml

       

      jboss-deployment-structure.xml

      <jboss-deployment-structure>

      <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

      <deployment>

      <dependencies>

      <module name="javaee.api" export="true"/>

      <module name="sun.jdk" export="true"/>

                   <module name="javax.api" export="true"/>

      <module name="com.oracle.ojdbc6" export="true"/>

      </dependencies>

      </deployment>

      </jboss-deployment-structure>

       

       

      Issue:

      When I am trying to access a LocalHome Interface from outside the ejbjar, I am getting the following exception.

      20:15:44,870 ERROR [stderr] (WorkerThread-4) javax.naming.NameNotFoundException: java:app/testcmp/Test!com.test.cmp.TestLocalHome

      20:15:44,870 ERROR [stderr] (WorkerThread-4) at org.jboss.as.naming.InitialContext.findContext(InitialContext.java:198)

      20:15:44,870 ERROR [stderr] (WorkerThread-4) at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:118)

      20:15:44,870 ERROR [stderr] (WorkerThread-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:183)

      20:15:44,870 ERROR [stderr] (WorkerThread-4) at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)

      20:15:44,870 ERROR [stderr] (WorkerThread-4) at javax.naming.InitialContext.lookup(InitialContext.java:392)

       

      Scenario: I deployed a ear with the following structure

      1. test.ear

                      | testcmp.jar

                      | testsessionbean.jar

                      |testweb.war

                      |lib/sample.jar

       

      I have a cmp in testcmp.jar  and When deployed I am able to see

      20:02:09,183 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named Test in deployment unit subdeployment "testcmp.jar" of deployment "test.ear" are as follows:

       

                      java:global/test/testcmp/Test!com.test.cmp.TestLocalHome

                      java:app/testcmp/Test!com.test.cmp.TestLocalHome

                      java:module/Test!com.test.cmp.TestLocalHome

                      java:global/test/testcmp/Test!com.test.cmp.TestLocal

                      java:app/testcmp/Test!com.test.cmp.TestLocal

                      java:module/Test!com.test.cmp.TestLocal

       

      I have a cmp in testcmp.jar and invoking it from a file  in sample.jar like this

       

      public static EJBLocalHome findEJBLocalHome(String name) throws FCException

                      {

       

                                      try {

                                                      EJBLocalHome chome = (EJBLocalHome) homes.get(name);

                                                      if (chome == null) {

                                                                      Object home = m_context.lookup(name);

                                                                      chome = (EJBLocalHome) narrow(home, EJBLocalHome.class);

                                                                      homes.put(name, chome);

                                                      }

                                                      return chome;

                                      }

                                      catch(NamingException ne) {

                                                      ne.printStackTrace();

                                      }

                                      catch(Exception e) {

                                                      e.printStackTrace();

                                      }

                      }

       

       

      When I am invoking the cmp from the file as above, it is throwing exception

      But surprisingly when I invoke the cmp from the stateless session bean which is in testsessionbean.jar and then envoke it again from the file in lib/sample.jar, no exception is happening.

      Is there I am missing any thing here .

       

      Regards

      Srini