Question

In IntelliJ, is it possible to configure the embedded jetty server used by GWT with a custom jetty-web.xml? I would like to configure my web application to read some init-parameters from jetty-web.xml instead specifying the same web.xml in the web application. We use this approach to remove server context specific configuration in web.xml, however on development machine we still need to set these settings manually in web.xml, it would be nice to reproduce the same behaviour on development machines too.

I have tried placing a jetty-web.xml in WEB-INF directory, however each time the application is launched from IntelliJ the following exception is thrown:

java.lang.ClassNotFoundException: org.eclipse.jetty.webapp.WebAppContext at java.lang.ClassLoader.findClass(ClassLoader.java:522) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352) at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337) at org.mortbay.util.Loader.loadClass(Loader.java:91) at org.mortbay.xml.XmlConfiguration.nodeClass(XmlConfiguration.java:216) at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:179) at org.mortbay.jetty.webapp.JettyWebXmlConfiguration.configureWebApp(JettyWebXmlConfiguration.java:109) at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1217) at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513) at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448) at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) at org.mortbay.jetty.Server.doStart(Server.java:222) at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39) at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672) at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509) at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1093) at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:836) at com.google.gwt.dev.DevMode.main(DevMode.java:311)

Any thoughts?

Était-ce utile?

La solution

You're using an old(er) version of GWT, which embeds an old version of Jetty (namely Jetty 6.1.11, see https://stackoverflow.com/a/17592318/116472) whose package name is org.mortbay.jetty, not org.eclipse.jetty.

GWT 2.6 updated to Jetty 8, but that "feature" was lost (there are some classloader issues).

In any case, jetty-web.xml never was officially supported by GWT, so I'd recommend not using it (particularly now that it breaks in GWT 2.6). If you need more than just running your web app, then use an external server and launch DevMode in -noserver mode: http://www.gwtproject.org/doc/latest/DevGuideCompilingAndDebugging.html#How_do_I_use_my_own_server_in_development_mode_instead_of_GWT%27s

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top