Debugging the GWT server-side code using a TomCat instance

advertisements

I'm setting up a project to use MySQL as the datasource and I'm running into a couple problems.

  1. It appears the MySQL drivers for the Java side are incompatible with the built in GWT Jetty instance. Really?
  2. I can configure a TomCat instance and get MySQL Driver working, but I can't debug inline (Client & server together) like I normally would be able to do using the Jetty instance in dev mode, according to Google Docs.

I spent quite a while deciding between a PHP or Java backend, and one of the main advantages besides the GWT RPC mechanism was the fact that GWT provides a nice Development environment if you use Java.

Has anyone encountered the need to use a data source other than appEngine? How did you setup dev environment?


I do believe the MySQL JDBC driver is "compatible" with the embedded Jetty; but maybe you were in an AppEngine project, in which case the embedded Jetty server forbids the use of classes that are not compatible with AppEngine (so you have at dev time a behavior as similar as possible with the production environment on Google's servers).

To debug your server code running in Tomcat, you either need to launch it (the server code) using Eclipse WTP (or equivalent if you don't use Eclipse), or launch your Tomcat instance with the appropriate debug arguments e.g. -agentlib:jdwp=transport=dt_socket,address=8788,server=y,suspend=y, and then debug it as a "Remote Java Application" (in Eclipse, I don't now how they name it in other IDEs). You can then launch your DevMode in -noserver mode (and in debug) to debug your server and client at the same time (yes, you'll actually have 2 debug sessions).

Note that the doc you refer to (whose latest version can be found here) doesn't deal with debugging the server-side code, as it's highly dependent on the server you use, how and where it's deployed, etc. GWT code on the server side is just a standard servlet, so there's nothing specific to GWT re. how to debug the server-side code.

FYI, we do use a standalone Jetty instance (not the embedded Jetty server) for more than a year using the above setup.