1 Reply Latest reply on May 16, 2006 4:28 PM by C H

    unit testing with multiple ejb jars with the embeddable cont

    C H Newbie

      I'm trying to run some unit tests using Embeddable EJB3 Container (Alpha 5). The basic tests work when I have one jar file that
      contains both DAO and entity classes (persistence.xml in the META-INF directory). However when I separate the DAO (local stateless
      session bean) into a separate jar, i.e. one jar for the DAO classes and another jar for the entity classes with the persistence.xml,
      I got the javax.naming.NameNotFoundException from InitialContext lookup() of the sls bean:

       InitialContext ctx = getInitialContext(); /* this method comes from the Alpha 5 tutorial */
       MyEntityDAO dao = (MyEntityDAO) ctx

      javax.naming.NameNotFoundException: MyEntityDAOImpl not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)

      However the log shows the bean was bound

      2006-05-16 12:01:18,477 INFO [org.jboss.ejb3.MCKernelAbstraction] installing bean: jboss.j2ee:service=EJB3,jar=my-dao,name=MyEntityDAOImpl with dependencies:
      2006-05-16 12:01:18,477 INFO [org.jboss.ejb3.MCKernelAbstraction] AbstractDependencyMetaData@807f85{dependency=persistence.units:unitName=myEntityManager}
      2006-05-16 12:01:18,477 DEBUG [org.jboss.ejb3.Ejb3Deployment] Bound ejb3 container jboss.j2ee:service=EJB3,jar=my-dao,name=MyEntityDAOImpl

      When I do the lookup with the stateless session bean that is packaged in the entity jar, then it works.

      Does anyone have any pointers on unit testing with multiple ejb jars with the embeddable container?