1 Reply Latest reply on Sep 6, 2009 2:57 AM by Romy Baba

    EJB 3 and JNDI error

    Romy Baba Newbie

      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">
       <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>

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

      3. The Stateless Session bean implementation
      public abstract TestParent implements Test {
      public TestBean extends TestParent {
       public void 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);
       } catch (NamingException e) {
       throw e;

      What am i doing wrong?

      Please any help will be appreciated.