web.xml not found in classloader (under Arquillian)
ventmonkey Feb 8, 2011 7:33 PMHi all. I just mavenized my EAR project, and can successfully install/deploy it. I am now trying to get Arquillian working. I have the following code...
@Deployment public static Archive<?> getTestArchive() { // EJB-JAR final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, "test.jar").addResource("seam.properties", "seam.properties").addResource("META-INF/ejb-jar.xml", "META-INF/ejb-jar.xml").addResource("META-INF/persistence.xml", "META-INF/persistence.xml"); // WAR final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war").setWebXML("web.xml").addResource("WEB-INF/components.xml", "WEB-INF/components.xml"); // EAR final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear").addModule(ejb).addModule(war).addModule("org.jboss.seam:jboss-seam:2.2.1.GA") .addLibrary("org.jboss.el:jboss-el:1.0_02.CR4"); return ear; }
I can load the resources in my EJB, but not my war. I am getting the error...
... 18 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.arquillian.impl.DeploymentAnnotationArchiveGenerator.generateApplicationArchive(DeploymentAnnotationArchiveGenerator.java:57) ... 22 more Caused by: java.lang.IllegalArgumentException: war/web.xml not found in classloader sun.misc.Launcher$AppClassLoader@5acac268 at org.jboss.shrinkwrap.impl.base.Validate.notNull(Validate.java:44) at org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:64) at org.jboss.shrinkwrap.impl.base.asset.ClassLoaderAsset.<init>(ClassLoaderAsset.java:48) at org.jboss.shrinkwrap.impl.base.container.WebContainerBase.setWebXML(WebContainerBase.java:84) at com.myproj.ArquilianTest.getTestArchive(ArquilianTest.java:51)
If I do
mvn install -DskipTests
then a 'find' for web.xml, it is at
./myproj-war/target/myproj-war-1.0-SNAPSHOT/WEB-INF/web.xml
./myproj-war/src/main/webapp/WEB-INF/web.xml
but after running
mvn clean test -Pjbossas-remote-6
'find' only finds web.xml at
./myproj-war/src/main/webapp/WEB-INF/web.xml
I have tried every version of .setWebXML("web.xml") I can think of "WEB-INF/web.xml", specifying the war, the ear/war, etc. As i am fairly new to Maven, I might well be doing something dumb. Any ideas?
Thanks,
Mason