Wednesday, January 22, 2014

Re: 2.6.0-rc3 and Jetty's WebAppContext (jetty-web.xml)

On Wednesday, January 22, 2014 11:53:27 AM UTC-5, Thomas Broyer wrote:


On Tuesday, January 21, 2014 10:12:52 PM UTC+1, Thad Humphries wrote:
In short: How to I configure my GWT 2.6.0-rc* webapp launch in Eclipse and process webapp context settings for Jetty?

I'm giving GWT 2.6.0-rc3 a trial run using Maven and SuperDevMode. I launch the code server in a console with "mvn clean generate-sources gwt:run-codeserver" and launch my webapp from Eclipse.

With GWT 2.5.1, I created src/main/webapp/WEB-INF/jetty-web.xml such as

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" 

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  <Set name="initParams">
    <New class="java.util.HashMap">
      <Put name="app.tmpdir">/Users/thad/temp</Put>
      <Put name="cleanup.interval">86400</Put>
      <Put name="slf4j-init-file">/Users/thad/temp/slf4j.properties</Put>
    </New>
  </Set>
       
</Configure>

/Users/thad/temp/slf4j.properties declares "log4j.appender.MYAPP.File=/Users/thad/temp/mobile-slf4j.log" so I don't have to go chasing my log fill around my Mac's /var/folders directory.

This all works great with GWT 2.5.1 (as it did on an earlier project with GWT 2.5.1 using Ant and DevMode). And all this without any Jetty dependency in my pom.xml

However when I try GWT 2.6.0-rc3 (and GWT 2.6.0-rc1) a try, launching my webapp in Eclipse I get various errors in my console. Jetty does not read jetty-web.xml and my log file is no where to be found.

With the jetty-web.xml above, I get

[WARN] Server resource 'org/eclipse/jetty/xml/configure_6_0.dtd' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry 'file:/opt/gwt-2.6.0-rc3/gwt-dev.jar' to the web app classpath for this session
   For additional info see: file:/opt/gwt-2.6.0-rc3/doc/helpInfo/webAppClassPath.html
Starting Jetty on port 8888
   [WARN] Unable to process jetty-web.xml
java.lang.ClassNotFoundException: org.mortbay.jetty.webapp.WebAppContext
at java.lang.ClassLoader.findClass(ClassLoader.java:531)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:407)
at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
at org.eclipse.jetty.util.Loader.loadClass(Loader.java:100)
....

BTW, I see no such [WARN] on gwt-dev.jar with GWT 2.5.1 (gwt-dev is "<scope>provided</scope>" in my pom.xml).

On a hunch, I tried changing <Configure class="org.mortbay.jetty.webapp.WebAppContext"> to <Configure class="org.eclipse.jetty.webapp.WebAppContext"> but that gives the error below and the app fails to start:

[WARN] Server resource 'org/eclipse/jetty/xml/configure_7_6.dtd' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry 'file:/opt/gwt-2.6.0-rc3/gwt-dev.jar' to the web app classpath for this session
   For additional info see: file:/opt/gwt-2.6.0-rc3/doc/helpInfo/webAppClassPath.html
Starting Jetty on port 8888
   [WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload{/,file:/Users/thad/workspace/Mobile/target/Mobile-1.0-SNAPSHOT/},/Users/thad/workspace/Mobile/target/Mobile-1.0-SNAPSHOT
java.lang.IllegalArgumentException: Object of class 'com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders.
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:323)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:281)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:103)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:468)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1237)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
...

What's the magic?

It's "broken" (between quotes, because I don't think GWT ever willfully supported the use-case, so it was a "feature" but rather just "luck")



Thanks, Thomas. I understand the reasoning, but I don't agree with it. There are things I set in my app's context that I'd like to user during development without the hassle of compiling or using -noserver and losing the Eclipse debugger. If Jetty configuration can be put back, it would be greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment