-
1. Re: EnterpiseArchive (no war) 404 error
luigib Nov 18, 2010 8:55 PM (in response to luigib)Hi,
I've just found out that it works if I add to the test.ear archive an (almost) empty test.war archive, using this code:
....
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addResource(EmptyAsset.INSTANCE, "empty.xhtml");
adaptorEar.add(war, "/");.....
I wonder if I am doing something wrong...
Luigi
-
2. Re: EnterpiseArchive (no war) 404 error
luigib Nov 18, 2010 9:29 PM (in response to luigib)...yes, I was definitely doing something wrong. In the EnterpriseArchive creation method I was introducing in the archive my own application.xml. So I had:
public static EnterpriseArchive createAdaptorEar() {
EnterpriseArchive adaptorEar = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
.addModule(new File(LIB_PATH + "logback-classic-0.9.16.jar"))
.addModule(new File(LIB_PATH + "logback-core-0.9.16.jar"))
.addModule(new File(LIB_PATH + "slf4j-api-1.5.8.jar")).addModule(new File(LIB_PATH + "my-module.jar"))
.addResource("application-test.xml", "application.xml");
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addResource(EmptyAsset.INSTANCE, "empty.xhtml");
adaptorEar.add(war, "/");return adaptorEar;
}
This works, provided that the empty WebArchive is created and listed in the application.xml used for testing (application-test.xml).
However it's fairly useless (at least in my case), since this works as well and it's simpler:
public static EnterpriseArchive createAdaptorEar() {
EnterpriseArchive adaptorEar = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
.addModule(new File(LIB_PATH + "logback-classic-0.9.16.jar"))
.addModule(new File(LIB_PATH + "logback-core-0.9.16.jar"))
.addModule(new File(LIB_PATH + "slf4j-api-1.5.8.jar")).addModule(new File(LIB_PATH + "my-module.jar"));
return adaptorEar;
}
Arquillian takes care of the rest.
On a slightly different note, I've noticed that the EnterpriseArchive has to be named test.ear, otherwise I get an error (injection failure).
Anyway, that's it. It works now. It looks very promising. Sorry if I bothered you.
Luigi
-
3. Re: EnterpiseArchive (no war) 404 error
aslak Nov 19, 2010 3:44 AM (in response to luigib)Just adding the EnterpriseArchive should work and should be the only thing you need. When you add your own WebArchives, the packager in the background is a bit weak at the moment and does not manage to merge the WebArchives.
And yes, in current release you need to call it test.ear to get the guessing game done in the EJB enricher to function. We're working on this.