IAmYourFaja
IAmYourFaja

Reputation: 56914

Debug GWT app locally/remotely while running on Tomcat

All of the tutorials/links/articles I have found for debugging GWT involve:

I would like to know how to debug a GWT app while it runs from a non-Eclipse web container; specifically a full-blown Tomcat instance that is either running on the same machine (localhost:8080) or on a remote machine somewhere else.

Ideally, I'd be able to access my app normally, via browser, but as I interact with the app (clicking buttons, etc.), Eclipse would be running in Debug mode, and would hit breakpoints that I set ahead of time (before the deploy).

To my surprise, there isn't much out there on this that I could find, and certainly nothing definitive. So I was wondering if any battle-weary GWT veterans could shed some light on how I could do this.

If at all possible, I'd prefer not to install the Google-Eclipse plugin, unless that is the only option for achieving this. Thanks in advance!

Upvotes: 3

Views: 6313

Answers (2)

Laksitha Ranasingha
Laksitha Ranasingha

Reputation: 4507

I am not sure if you missed this documentation. I used to do remote debugging in my dev mode where my server is running in the VM. I can suggest you two solutions.

If you are using a version prior to GWT 2.5 you have to give the noserver argument in launch configuration providing the url for the host page in the server (Tomcat etc). I have extracted the steps from above documentation.

  1. Configure your server however you need to; note the URL which contains the host page for your GWT application.
  2. Arrange all your static content files (such as the host HTML page, images, CSS, etc.) on the server however you like.
  3. Edit your development mode execution script (such as your Eclipse run configuration or the ant development build target generated by the GWT webAppCreator) and add or update the following options: • Add the -noserver command line argument. • Change the URL at the end of the argument list to match the URL you recorded in step #1.
  4. Compile your application once using the ant build target. Ideally, you can use GWT's -war option to generate output files directly into your external server's static content folder. Otherwise, you'll need to copy the the GWT output folder from war/ to your external server's static content.

If you are using 2.5 or above you can use super dev mode. In super dev mode you can debug using the browser so no need of eclipse plugin. I have tried this and worked fine. However I was unable to load the java sources using source maps. Here is the documentation for superdevmode configuration.

Upvotes: 2

Mayank Pandya
Mayank Pandya

Reputation: 1623

It's really easy, just follow these steps:

Get google plugin for eclipse

The in eclipse, right click on your project and choose Debug as -> Web Application (running on external server)

Enter URL of your web app on tomcat (like

http://localhost:8080/YourApp/YourApp.html

and eclipse will give you new one - it will add stuff like ?gwt.codesvr=127.0.0.1:9997 And that's it. Just set up your breakpoints and debug!

Also take a look on this

Upvotes: -1

Related Questions