1 Reply Latest reply on Feb 26, 2007 7:56 PM by Daniel Hinojosa

    Entity EJBs are not detected in a directory unless they are

    Daniel Hinojosa Master

      I find myself a wee bit frustrated at the following problem. First off, I am using testNG, and Cobertura for code coverage (which makes this problem important). So, I have a EJB3Container class that get invoked from testNG and the code looks like this...

      public class EJB3Container {
      
       private EJB3StandaloneDeployer deployer;
      
       @BeforeSuite(groups="integration")
       public void startup() {
       try {
       EJB3StandaloneBootstrap.boot(null);
       EJB3StandaloneBootstrap.scanClasspath();
       } catch (Exception ex) {
       throw new RuntimeException(ex);
       }
       }
      
       @AfterSuite(groups="integration")
       public void shutdown() {
       try {
      
       EJB3StandaloneBootstrap.shutdown();
       } catch (Exception ex) {
       throw new RuntimeException(ex);
       }
       }
      }
      



      Within the classpath that is being scanned is the bean, the local interface, the remote interface, AND the entity bean. When I run my testNG it scans the classpath, BUT it doesn't recognize the Entity classes. I really don't want to package the classes since they are instrumented. So can I do it without packaging?



        • 1. Re: Entity EJBs are not detected in a directory unless they
          Daniel Hinojosa Master

          Now I found an answer, and that answer is....

          The META-INF/persistence.xml needs to be next to class files (did the documentation say that?)

          so whether you are loading from a directory or a jar file the rules are:

          +-META-INF
          | +-persistence.xml
          +-com
          +-mycorp
          +-blah
          +-Person.class
          +-PersonBean.class
          +-PersonRemote.class
          +-PersonLocal.class

          My new question is, will there a be a way in the final Embedded distro where the META-INF doesn't necessarily have to be next to the class files?