Running GWT Speedtracer without Jetty

2020-02-26 13:48发布

问题:

We are trying to run the GWT (2.1) Speedtracer, but have trouble with it, since Jetty doesn't accept our JDBC resources (they work fine in Tomcat) - probably because the JAR containing the drivers is not found by it.

Is there a way to make the GWT speedtracer run without the Jetty Server?

Or how do I make the web.xml/context.xml compatible with both Tomcat and Jetty?

I would prefer to run it in Jetty - as long as this won't cause problems with tomcat.

回答1:

If you want to use Tomcat:

The GWT documentation mentions, that you can use Speed Tracer on the server-side with the SpringSource tc Server (which is a Tomcat server).

If you want to use Jetty:

Using DataSources with the embedded GWT Jetty server is possible, but not easy. It's explained in this Google Group post for GWT 1.6. I have tried this with GWT 2.1, and it basically remains the same procedure. Here's a quick outline:

  • enable JNDI for the embedded Jetty:
    • add jetty-naming-*.jar, jetty-plus-*.jar
    • modify the JettyLauncher,
    • add the VM arg -Djava.naming.factory.initial=org.mortbay.naming.InitialContextFactory (or use jndi.properties)
  • create a jetty-env.xml (similar to Tomcat's context.xml)
  • define a resource-ref in the web.xml