0 Replies Latest reply on Mar 15, 2012 5:22 AM by Łukasz Kasprzyk

    JNDI lookup using spring org.springframework.jndi.JndiObjectFactoryBean

    Łukasz Kasprzyk Newbie

      I try migrate my weblogic ear aplication to jboss.

      I my ear aplication i have 17 modules, witch interacts between themeselves. In xml file I have EJB beans described in that way:

       

       


      <bean id="iexecutor"


      class="org.springframework.jndi.JndiObjectFactoryBean"


      lazy-init="true">


      <property name="jndiName"


      value="java:comp/env/ejb/CibConnectorFacadeBean" />

      </bean>

       

       

      and it works fine ( I don't have to specify module name for any bean, even if it comes from diffrent module).

       

      In jboss durig deployment my application I can see few lines witch contains information about ejb jndi

       

      09:58:28,578 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings f

      or session bean named CibConnectorFacadeBean in deployment unit subdeployment "ejb-connector-1.0-SNAPSHOT.jar" of deployment "alr-retail-con

      nector-app-1.0-SNAPSHOT.ear" are as follows:

              java:global/alr-retail-connector-app-1.0-SNAPSHOT/ejb-connector-1.0-SNAPSHOT/CibConnectorFacadeBean!com.comarch.cib.ejb.connector.interfaces.CibConnectorInterface

              java:app/ejb-connector-1.0-SNAPSHOT/CibConnectorFacadeBean!com.comarch.cib.ejb.connector.interfaces.CibConnectorInterface

              java:module/CibConnectorFacadeBean!com.comarch.cib.ejb.connector.interfaces.CibConnectorInterface

              java:jboss/exported/alr-retail-connector-app-1.0-SNAPSHOT/ejb-connector-1.0-SNAPSHOT/CibConnectorFacadeBean!com.comarch.cib.ejb.connector.interfaces.CibConnectorInterface

              java:global/alr-retail-connector-app-1.0-SNAPSHOT/ejb-connector-1.0-SNAPSHOT/CibConnectorFacadeBean

              java:app/ejb-connector-1.0-SNAPSHOT/CibConnectorFacadeBean

              java:module/CibConnectorFacadeBean

       

      When I use JNDI: "java:module/CibConnectorFacadeBean " it works only in the same module, but don't work wheny I try get them from other module.

      I cannot specify i my xml file with Ejb spring beans definitions full name with application and module name, ie : " java:global/alr-retail-connector-app-1.0-SNAPSHOT/ejb-connector-1.0-SNAPSHOT/CibConnectorFacadeBean", because I have few environment with diffrent versions of my application (so module names and ear-app name are diffrent).

      Is any way to specify JNDI name witch will be without module and app name and will be available from diffrent module?

       

      Instead of using JndiObjectFactoryBean we can just use method lookup from  InitialContext (the result is the same- don't work).