Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to do integration testing of CDI on Embedded EJBContainer
    text
    copied!<p>We have a Maven multi-module project with some ejb and war modules. One of the modules works as an integration tester for the whole platform. We have successfully tested ejbs, including security, dependency injection and transactions by using the embedded EjbContainer.</p> <p>Now we want to add CDI to the mix and here it is when problems arise.</p> <h1>Problem</h1> <p>According to the doc, in order to activate CDI we simply have to add an empty <strong>beans.xml</strong> into the <strong>META-INF</strong> folder of the ejb module in which we want to activate it. Simple as that, right after doing it the embedded server cannot start and therefore we cannot run any integration test.</p> <p>The exception thrown is:</p> <pre><code>java.lang.RuntimeException: javax.ejb.EJBException: Failed to deploy EJB modules - see log for details ... Caused by: javax.ejb.EJBException: Failed to deploy EJB modules - see log for details </code></pre> <p>The rest of the stackTrace just points to the line in which we try to start the server and provides no useful information.</p> <p>Two things to note:</p> <ul> <li>The startup fails even without having any @Injected bean.</li> <li>CDI works fine when running in the non-embedded glassfish, <strong>so our problem is only on testing</strong>.</li> </ul> <h1>Our system</h1> <p><strong>Maven project structure</strong> </p> <p>myproject<br> myproject-ear<br> myproject-domain<br> myproject-ejb1<br> myproject-ejb2<br> myproject-war<br> myproject-test </p> <p><strong>Environment</strong><br> - Glassfish 3.1, 3.2<br> - TestNG</p> <pre><code>File[] modules = { new File("/target/classes"), new File("../myproject-ejb1/target/classes"), new File("../myproject-ejb2/target/classes") ...}; properties.put(EJBContainer.APP_NAME, "myproject"); properties.put(EJBContainer.MODULES, modules); properties.put("org.glassfish.ejb.embedded.glassfish.instance.root","./src/main/resources"); EJBContainer container = EJBContainer.createEJBContainer(properties); </code></pre> <h1>What we have found so far</h1> <p>We have enabled finer logging on glassfish but still we get no clue of what is failing. </p> <p><strong>We know about Arquillian</strong>, and we consider it as a possibility but we would like try one last time with the standard api.</p> <p>Any idea of what could we be doing wrong?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload