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.
Now we want to add CDI to the mix and here it is when problems arise.
Problem
According to the doc, in order to activate CDI we simply have to add an empty beans.xml into the META-INF 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.
The exception thrown is:
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
The rest of the stackTrace just points to the line in which we try to start the server and provides no useful information.
Two things to note:
- The startup fails even without having any @Injected bean.
- CDI works fine when running in the non-embedded glassfish, so our problem is only on testing.
Our system
Maven project structure
myproject
myproject-ear
myproject-domain
myproject-ejb1
myproject-ejb2
myproject-war
myproject-test
Environment
- Glassfish 3.1, 3.2
- TestNG
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);
What we have found so far
We have enabled finer logging on glassfish but still we get no clue of what is failing.
We know about Arquillian, and we consider it as a possibility but we would like try one last time with the standard api.
Any idea of what could we be doing wrong?