-
1. Re: glassfish-remote and contextRoot
mleduque Nov 18, 2011 7:27 AM (in response to mleduque)The stranger is that the EAR actually deployed in the server.
Still, for arquillian, the deploy failed.
-
2. Re: glassfish-remote and contextRoot
zpaulovics Nov 18, 2011 11:39 PM (in response to mleduque)1 of 1 people found this helpfulHi,
You can set the context root by the name of your deployment or in your glassfish-web.xml file.
- If you do not have sun-web.xml or glassfish-web.xml file in your web application, the GlassFish will use the name of your deployment without the extension as contextroot.
- For how to define the context root in sun-web.xml or glassfish-web.xml file, please refer to GlassFish Server Open Source Edition 3.1 Application Deployment Guide -› The glassfish-web.xml File (page 89).
For more details related to GlassFish 3.1 remote container, you can found the documentation here: https://docs.jboss.org/author/display/ARQ/GlassFish+3.1+-+Remote
You can find an example of ear web application test here: git://github.com/arquillian/arquillian-container-glassfish.git in the file: /src/test/java/org/jboss/arquillian/container/glassfish/remote_3_1/GlassFishRestDeployEarTest.java
{code}
public static Archive<?> getTestArchive() {
final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(GreeterServlet.class);
final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClasses(Greeter.class);
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
.setApplicationXML("application.xml")
.addAsModule(war)
.addAsModule(ejb);
log.info(ear.toString(true));
return ear;
}
{code}
Regards,
ZoPa
-
3. Re: glassfish-remote and contextRoot
mleduque Nov 21, 2011 10:51 AM (in response to zpaulovics)OK, that's a already good thing to know the doc is not exact, thanks.
I'll try that, but that feels really strange to put a *-web.xml as I don't have a web part (i.e. no war, no webservices, no servlets...).
-
4. Re: glassfish-remote and contextRoot
mleduque Nov 22, 2011 6:05 AM (in response to mleduque)Hmm, I have to put a
{code}<glassfish-application>
<web>
<web-uri>???</web-uri>
<context-root>context</context-root>
</web>
</glassfish-application>{code}
in the EAR *but* I'm still stuck by the fact that I have *no* web component inside, so it's a bit problematic to find how I should fill the fields...
-
5. Re: glassfish-remote and contextRoot
zpaulovics Nov 22, 2011 4:56 PM (in response to mleduque)Hi Mickaël,
You have faced with the ARQ-658 issue. It has been fixed in the master already. The contextroot is automatically specified by the container for you, so there is no need to put the application.xml into the archive. If one do not have any web componet (as it is your case now), the application.xml can not be included.
This is my test deployment:
{code}
public class GlassFishRestDeployEarTest {
@Deployment
final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClasses(Greeter.class, GlassFishRestDeployEarTest.class);
log.info(ejb.toString(true));
final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
.addAsModule(ejb);
log.info(ear.toString(true));
return ear;
}
...
{code}
And this is my test log:
{code}
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestDeployEarTest
Nov 22, 2011 4:10:55 PM org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestDeployEarTest getTestArchive
INFO: test.jar:
/org/
/org/jboss/
/org/jboss/arquillian/
/org/jboss/arquillian/container/
/org/jboss/arquillian/container/glassfish/
/org/jboss/arquillian/container/glassfish/remote_3_1/
/org/jboss/arquillian/container/glassfish/remote_3_1/GlassFishRestDeployEarTest.class
/org/jboss/arquillian/container/glassfish/remote_3_1/Greeter.class
Nov 22, 2011 4:10:55 PM org.jboss.arquillian.container.glassfish.remote_3_1.GlassFishRestDeployEarTest getTestArchive
INFO: test.ear:
/test.jar
Nov 22, 2011 4:10:56 PM org.jboss.arquillian.container.glassfish.remote_3_1.clientutils.GlassFishClientService resolveWebModuleContextRoot
INFO: contextRoot: test
Nov 22, 2011 4:10:56 PM org.jboss.arquillian.container.glassfish.remote_3_1.clientutils.GlassFishClientService doDeploy
INFO: HTTPContext [host=localhost, port=8080, servlets=
Servlet [name=default, contextRoot=/test]
Servlet [name=ArquillianServletRunner, contextRoot=/test]
Servlet [name=jsp, contextRoot=/test]]
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.615 sec
{code}
Note: If your @Deployment does not have the "testable = false" parameter (it is not a client test), arquillion will append its servlets to your artifact (like ArquillianServletRunner, etc.) as you can see in the above log.
-
6. Re: glassfish-remote and contextRoot
mleduque Nov 23, 2011 3:13 AM (in response to zpaulovics)OK, thanks, I understand now.
So as a workaround until the next release version, I just have to add a dummy war with a dummy servlet in the ear ?
-
7. Re: glassfish-remote and contextRoot
zpaulovics Nov 23, 2011 3:59 AM (in response to mleduque)Yes, your right, or you can use offline the attached arquillian-glassfish-remote-3.1-1.0.0.Final-SNAPSHOT.jar in your projects.