Problem with Latest Arquillian
In making the shift to Glassfish 4, I also upgraded the version of Arquillian and ShrinkWrap I was using and ran into essentially classpath hell. I figured my adventures were sufficient that I would blog about it.
First off, once I had it all working, I ran into a bug under Arquillian 1.1.1.Final. The exception was
WELD-001456 Argument resolvedBean must not be null
It turns out, there is an existing bug for this: . In order to workaround this bug, I needed to use Arquillian 1.0.3.Final. Hopefully this will get fixed soon and I can move up.
Updates to pom.xml
So moving to what I changed (that is why you came here right?) lets start with the pom.xml.
- Since J2EE 7 uses a pretty recent version of Jersey for JAX-RS compliance, I modified my included Jersey dependencies from compile to provided. (The exception was jersey-client used in my tests that I might not need anymore with the latest JSR specs). I tied the version to the version in Glassfish 4 for compatibility (1.17)
- I didn't think I would need eclipselink when testing with the embedded glassfish, but this turned out to be needed. So for this I used the 2.5.0 version matching Glassfish 4. As well, since I do not have a compile time dependency I changed the scope from provided to runtime.
- I was previously including the dependency
org.eclipse.persistence.moxyto support MOXy in my application, but since this is the default provider now for Glassfish 4 JAXB processing (for JSON) I was able to remove it.
- For the
glassfish-embedded-allartifact, I switched to use 4.0.
- Finally, in the surefire-plugin configuration, I had some classpath dependency exclusions. I had to add CDI to this or else Arquillian was bombing out (one of the JARs was bringing in a incompatible version of cdi-api). I found this using the netbeans maven plugin and the graphical display and this really helps. For reference here is the exclusions:
<classpathDependencyExcludes> <classpathDependencyExcludes>javax.servlet:servlet-api</classpathDependencyExcludes> <classpathDependencyExcludes>org.apache.felix:javax.servlet</classpathDependencyExcludes> <classpathDependencyExcludes>javax:javaee-web-api</classpathDependencyExcludes> <classpathDependencyExcludes>javax.enterprise:cdi-api</classpathDependencyExcludes> <classpathDependencyExcludes>org.jboss.spec:jboss-javaee-web-6.0</classpathDependencyExcludes> </classpathDependencyExcludes>
- Updated the version of ShrinkWrap to 2.0.0
I would provide the full pom.xml, but it is quite large (currently 508 lines) so I only included these snippets (also pygments.org is not up so I can not get nicely formatted code) .
Overall, this was a little more painful than I expected - although most of the pain came in the changes to ShrinkWrap and Arquillian versions that I thought I needed for GF4. What compounded this was the sneaky inappropriate version of CDI that was causing all the dependency injection to fail.