0 Replies Latest reply on Apr 18, 2007 11:23 AM by Daniel Felix

    Could not access Remote Session Bean using JNDI lookup on JB

    Daniel Felix Newbie

      Hi, People

      I'm using JBoss 4.0.5 and my client-application provokes an error when it calls lookup method.

      My client-application is a web application with Struts 2.0.


      My web.xml :

      <ejb-ref>
      <ejb-ref-name>ejb/UserManagerBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.mc1.arautos.ejb.request.UserManagerRemote
      com.mc1.arautos.ejb.request.UserManagerLocal
      </ejb-ref>


      My jboss-web.xml :

      <ejb-ref>
      <ejb-ref-name>ejb/UserManagerBean</ejb-ref-name>
      <jndi-name>com.mc1.arautos.ejb.request.UserManagerRemote</jndi-name>
      </ejb-ref>


      Module EJB 3 STARTED - JBOSS :

      10:12:18,110 INFO [EJBContainer] STARTED EJB: com.mc1.arautos.ejb.request.UnitManagerBean ejbName: UnitManagerBean
      10:12:18,156 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=acnsf.ear,jar=acnsf-ejb.jar,name=UserManagerBean,service=EJB3 with dependencies:
      10:12:18,156 INFO [JmxKernelAbstraction] jboss.j2ee:ear=acnsf.ear,jar=acnsf-ejb.jar,name=EntityManagerBean,service=EJB3
      10:12:18,250 INFO [EJBContainer] STARTED EJB: com.mc1.arautos.ejb.request.UserManagerBean ejbName: UserManagerBean


      ERROR :

      007-04-16 15:03:21,192 ERROR [STDERR] 16/04/2007 15:03:21 com.mc1.arautos.application.UserManager lookupUserManagerBean
      SEVERE: exception caught
      javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: com.mc1.arautos.ejb.request.UserManagerRemote not bound]
      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1067)


      Method Lookup :

      private UserManagerRemote lookupUserManagerBean() {

      try {
      Context c = new InitialContext();
      return (UserManagerRemote) c.lookup("java:comp/env/ejb/UserManagerBean");
      }
      catch(NamingException ne) {
      java.util.logging.Logger.getLogger(getClass().getName()).log(Level.SEVERE,"exception caught" ,ne);
      throw new RuntimeException(ne);
      }
      }


      Any idea ? AnyBody Can help me ?
      Thanks.