1 Reply Latest reply on Jan 16, 2014 6:16 AM by Wolf-Dieter Fink

    Spring 3 integration with Jboss 7.1, javax.naming.NameNotFoundException

    Ivan Wang Newbie

      I'm recently migrating from Jboss 4 to Jboss 7.1. I've defined below ejb in spring

       

      <bean id="alertRSLB"
              class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"
              lazy-init="true">
              <property name="jndiName" value="test/testEJB/Test!com.test.TestRemote" />
              <property name="refreshHomeOnConnectFailure" value="true"/>
              <property name="businessInterface" value="com.test.TestService" />
              <property name="jndiTemplate">
                  <ref bean="jndiJBoss"/>
              </property>
          </bean>
      

       

      jndiTemplate is like below

      <bean id="jndiJBoss"
              class="org.springframework.jndi.JndiTemplate">
              <property name="environment">
                  <props>
                      <prop key="java.naming.factory.initial">
                      org.jboss.naming.remote.client.InitialContextFactory
                      </prop>
                      <prop key="java.naming.provider.url">
                        remote://localhost:1099
                      </prop>
                      <prop key="jboss.naming.client.ejb.context">
                         true
                      </prop>
                      <prop key="java.naming.factory.url.pkgs">
                          org.jboss.ejb.client.naming
                      </prop>
                      <prop key="java.naming.security.principal">test</prop>
        <prop key="java.naming.security.credentials">password</prop>
                  </props>
              </property>
          </bean>
      

       

      I build a simple client application, I can look up the TestRemote using jndi name ejb:test/testEJB/Test!com.test.TestRemote successfully.

       

      However, I got the NameNotFoundException if the "alertRSLB" bean is initialized. I also tried to add the "ejb:"prefix, no luck.

      Not sure it's due to the ejb deployed and invoked in the same AS7 instance. The ejb is defined in a jar, and it's invoked in the war, they're in the same ear. For DEV environment, I have them in the same Jboss. But in PRO, they're in different Jbosses.

      If that's the reason, how to remote invoke the ejb from the same server.

      ejb:test/testEJB/Test!com.test.TestReote