3 Replies Latest reply on Sep 23, 2013 3:02 AM by jaikiran

    Lookup JNDI within EAR does not work correctly

    arun168403

      I have a EJB 2.1 deployed in a EAR.

      The EJB is in a jar ejb-jar-tl1-tl1layer.jar and I'm trying to lookup this from an another EJB of the same EAR in the jar ejb-ems.jar

       

      I'm able to see the EJB getting deployed with JNDI as :

       

      java:global/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentLocal
      java:app/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentLocal
      java:module/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentLocal
      java:global/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentLocalHome
      java:app/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentLocalHome
      java:module/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentLocalHome
      java:global/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentHome
      java:app/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentHome
      java:module/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentHome
      java:jboss/exported/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipmentHome
      java:global/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipment
      java:app/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipment
      java:module/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipment
      java:jboss/exported/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.interfaces.NeEquipment
      
      
      

       

      in server.log

       

      I have add the Class-Path entry on the ejb-ems.jar with the ejb-tl1-tl1layer.jar and also added the dependecy in the jboss-deployment-structure.xml.

       

      MANIFEST.MF

       

      Manifest-Version: 1.0
      Ant-Version: Apache Ant 1.8.2
      Class-Path: global-jar-tl1-types.jar global-jar-gem-types.jar ejb-jar-tl1-tl1layer.jar ejb-jar-event-ps.jar ejb-jar-pass.jar global-jar-exsnmp-types.jar
      
      
      
      
      
      
      
      

      jboss-deployment-structure.xml:

      <sub-deployment name="ejb-ems.jar">
        <dependencies>
        <module name="deployment.gem.ear.ejb-jar-tl1-tl1layer.jar" />
        <module name="javax.api" />
        <module name="javax.jms.api" />
        <module name="javax.resource.api" />
        <module name="javax.validation.api" />
        <module name="javax.ejb.api" />
        </dependencies>
        </sub-deployment>
      
      
      
      
      
      

       

       

      When I try to lookup with the local-jndi name I'm getting NameNotFoundException as below:

       

      Caused by: com.alcatel.gem.exception.GEMDoesNotExistException: Could not find java:app/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome.
      at com.alcatel.gem.tl1.entity.ejb.NeVersionInfoTools.getDomainLocal(NeVersionInfoTools.java:167) [ejb-jar-tl1-tl1layer.jar:]
      at com.alcatel.gem.ems.ne.ejb.TL1Interface.forEachDomain(TL1Interface.java:1507) [ejb-ems.jar:]
      at com.alcatel.gem.ems.ne.ejb.TL1Interface.forEachDomain(TL1Interface.java:1457) [ejb-ems.jar:]
      ... 151 more
      Caused by: javax.naming.NameNotFoundException: ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome -- service jboss.naming.context.java.module.gem.ejb-jar-tl1-tl1layer."NeEquipment!com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome"
      at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:97)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:178)
      at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:123)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
      at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_25]
      at com.alcatel.gem.tl1.entity.ejb.NeVersionInfoTools.getDomainLocal(NeVersionInfoTools.java:157) [ejb-jar-tl1-tl1layer.jar:]
      ... 153 more
      
      
      
      
      
      

      So I tried the EJB to look with "ejb:" prefix. When I try to lookup and EJB I'm getting class not found exception as below:

       

      Caused by: com.alcatel.gem.exception.GEMDoesNotExistException: Could not find ejb:/gem/ejb-jar-tl1-tl1layer/NeEquipment!com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome?stateless.
      at com.alcatel.gem.tl1.entity.ejb.NeVersionInfoTools.getDomainLocal(NeVersionInfoTools.java:167) [ejb-jar-tl1-tl1layer.jar:]
      at com.alcatel.gem.ems.ne.ejb.TL1Interface.forEachDomain(TL1Interface.java:1507) [ejb-ems.jar:]
      at com.alcatel.gem.ems.ne.ejb.TL1Interface.forEachDomain(TL1Interface.java:1457) [ejb-ems.jar:]
      ... 151 more
      Caused by: javax.naming.NamingException: Could not load ejb proxy class com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome [Root exception is java.lang.ClassNotFoundException: com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome from [Module "deployment.gem.ear.ejb-ems.jar:main" from Service Module Loader]]
      at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:108) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
      at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:96) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
      at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:76) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
      at org.jboss.as.naming.InitialContext.lookup(InitialContext.java:100)
      at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:214)
      at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_25]
      at com.alcatel.gem.tl1.entity.ejb.NeVersionInfoTools.getDomainLocal(NeVersionInfoTools.java:157) [ejb-jar-tl1-tl1layer.jar:]
      ... 153 more
      Caused by: java.lang.ClassNotFoundException: com.alcatel.gem.tl1.Equipment.NeEquipmentLocalHome from [Module "deployment.gem.ear.ejb-ems.jar:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
      at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_25]
      at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_25]
      at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:106) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
      ... 159 more