Prior to the switch to Jetty 7.0.2 I have been using a local JNDI
datasource in hosted mode by placing a jetty-web.xml file in WEB-INF
such as:
<?xml version=”1.0”?>
<!DOCTYPE Configure PUBLIC “-//Mort Bay Consulting//DTD Configure//EN”
“
http://jetty.mortbay.org/configure.dtd”>
<Configure class=”org.mortbay.jetty.webapp.WebAppContext”>
<New id=”DerbyDS”
class=”org.mortbay.jetty.plus.naming.Resource”>
<Arg>jdbc/DerbyDS</Arg>
<Arg>
<New class="org.apache.derby.jdbc.EmbeddedDataSource">
<Set name="DatabaseName">db</Set>
<Set name="createDatabase">create</Set>
</New>
</Arg>
</New>
</Configure>
Then by adding the command line argument: -
Djava.naming.factory.initial=org.mortbay.naming.InitialContextFactory
With the switch to Jetty 7 I changed all of the class names in jetty-
web.xml and the command line argument from org.mortbay.jetty.* to
org.eclipse.jetty.* (as outlined in
http://wiki.eclipse.org/Jetty/Getting_Started/Porting_to_Jetty_7/Refactoring),
included all of the necessary additional Jars from Jetty 7.0.2 (jetty-
plus-*.jar, jetty-jndi-*.jar), but it does not seem to work.
When the embedded Jetty tries to load jetty-web.xml (which it loads
post-startup, after all other config files), I get the following
exception:
java.lang.IllegalArgumentException: Object is not of type class
org.eclipse.jetty.webapp.WebAppContext at
org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:
195) at
org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:
77) at
org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:
963) at
org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:
586) at
org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:349)
at com.google.gwt.dev.shell.jetty.JettyLauncher
$WebAppContextWithReload.doStart(JettyLauncher.java:460)
....
When I try to change the scope of the JNDI reference to jvm or Server
and rename the file to jetty.xml or jetty-env.xml (which are loaded
pre-startup, before any web application specific configs), I can get
the embedded jetty to start, but it never can find my naming
references.
I suspect it has to do with some of the org.eclipse.jetty.* classes
being included in gwt-dev.jar being on the classpath in hosted mode.
I've tried removing these classes from the jar and including all of
the generic Jetty 7.0.2 jars but it doesn't seem to make a difference.
Can anyone please offer a suggestion to try?