简体   繁体   中英

Debugging GWT server side code using a TomCat instance

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 eg -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.

You can use GWT and Tomcat and still be able to debug both client and server side. Look at the jetty startup parameters in Eclipse.

I have been in a similar position few years ago and decided to use Jetty for development and tomcat for testing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM