Hi again,
I found out some sort of hack that will allow me to run the embedded
container without Grizzly supporting the extra classpath itself, so I
finally gave GrizzlyWebServerDeployer a go :).
What I did was to download the .jar I found at the java.net Maven 2
repo (1.9.11-SNAPSHOT of grizzly-servlet-deployer) and embed it in my
app, like this:
---
theServer = new GrizzlyWebServerDeployer();
String[] args = new String[] { "-p", Integer.toString(port), "-a",
path_to_exploded_webapp };
theServer.init(args);
...
theServer.launch();
---
The server seems to launch ok, but then it seems to choke on the
web.xml file (referenced below) with an
"org.xml.sax.SAXParseException: Content is not allowed in prolog."
exception. However, the web.xml seems to be fine and it would be
confirmed by the fact that Jetty, Tomcat and Resin can process it
without problems. The exception itself does not say exactly the file
name, but removing the file removes the error (the application then
returns 404 for everything though) and the stacktrace reads "at
com.sun.grizzly.http.webxml.parser.helper.WebXmlHelper.getInfo(WebXmlHelper.java:81)",
hence my guess.
I understand that it's a snapshot but as it is such a simple web.xml
file, I thought I would give it a try.
The full stack trace is:
---
07-abr-2009 19:08:58
com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer deploy
INFO: deployed application path=path_to_exploded_webapp
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown
Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown
Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at com.sun.grizzly.http.webxml.parser.helper.WebXmlHelper.getInfo(WebXmlHelper.java:81)
at com.sun.grizzly.http.webxml.WebappLoader.load(WebappLoader.java:134)
at com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer.extractWebxmlInfo(GrizzlyWebServerDeployer.jav
a:643)
at com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer.deploy(GrizzlyWebServerDeployer.java:269)
at com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer.findApplications(GrizzlyWebServerDeployer.java
:209)
at com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer.launch(GrizzlyWebServerDeployer.java:671)
at org.wembed.impl.GrizzlyEmbeddedContainer.start(GrizzlyEmbeddedContainer.java:80)
at org.wembed.ServerLauncher.start(ServerLauncher.java:129)
at org.wembed.ServerLauncher.main(ServerLauncher.java:61)
And you can see the web.xml here:
http://kenai.com/projects/wembed/sources/source-code-repository/content/grizzly/test/web/WEB-INF/web.xml?rev=63
The .jar I'm using,
grizzly-servlet-deployer-1.9.11-20090407.120919-1.jar, is the one
located here:
http://download.java.net/maven/2/com/sun/grizzly/grizzly-servlet-deployer/1.9.11-SNAPSHOT/
Salute!
D.
PD: I also tested with java -jar grizzly-servlet-deployer.jar -a
path_to_exploded_webapp and got the same results.