1 Reply Latest reply on Sep 6, 2009 2:58 AM by bouroy

    JNDI Error EJB 3

      hi,
      I have deployed the EJB3 jar(having 1 stateless session EJB) in the EAR in JBOSS 5.1.0. The log file and the JNDI dump(from the JMX admin screen) show that the EJB has been deployed. But when I try to lookup the EJB from a java class I get the following exception,

      javax.naming.CannotProceedException; remaining name 'TestBean/remote'
       at javax.naming.spi.ContinuationContext.getTargetContext(ContinuationContext.java:43)
       at javax.naming.spi.NamingManager.getContinuationContext(NamingManager.java:770)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:832)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155)
       at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
       at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:153)
       at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
       at test.ejb3.TestApp..java:50)
      



      My lookup code:

      1. Spring config:
       <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
       <property name="environment">
       <props>
       <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
       <prop key="java.naming.provider.url">localhost</prop>
       <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
       </props>
       </property>
       </bean>
      


      2. The EJB 3 remote interface
       @Remote
       public interface Test {
       void test();
       }
      


      3. The Stateless Session bean implementation
      public abstract TestParent implements Test {
       ....
      }
      
      @Stateless
      public TestBean extends TestParent {
       public void test() {
       System.out.println("Test");
       }
      }
      
      


      4. EJB Session bean is deployed in an EAR file named: myear.ear

      5. The TestApp.java
      ...
      public void doIt() {
       try {
       Test test = (Test)jndiTemplate.lookup("myear/TestBean/remote", Test.class);
       test.test();
       } catch (NamingException e) {
       e.printStackTrace();
       throw e;
       }
      }
      


      What am i doing wrong?

      Please any help will be appreciated.

      bouroy



        • 1. Re: JNDI Error EJB 3

          Additional information to 5)

          the spring configuration for TestApp looks like:

           <bean id="tesApp" class="test.ejb3.TestApp">
           <property name="jndiTemplate" ref="jndiTemplate"/>
           </bean>
          


          thx for any help!