Google GWT: Debugging Server Side GWT Code

I recently was working on a project utilizing Google GWT. Many of the developers did not know how to setup and use the debugger with Google GWT projects. Instead, they were relying on logging. Logging is a great tool but a good debugger is invaluable.

This article seeks to allow a developer to debug GWT server side Java code. For this tutorial, we will be utilizing Intellij IDEA but fear not, Eclipse can do the same thing.

We will first assume that the gwt-maven-plugin org.codehaus.mojo is placed in your pom.xml. If you have not set this up, feel free to learn more here.

After verifying this, navigate to the root directory of your project and run the application utilizing “mvn gwt:run”. Now, open up your application and play around with it just to make sure everything is working correctly. This is important to minimize any variables that could cause failure when trying to setup the debugger.

Following this, rerun the project in debug configuration utilizing “mvn gwt:debug”. This will allow a debugger to attach on to localhost with port 8000. Now, navigate to your preferred IDE and create a “Remote” debug configuration that listens on localhost with port 8000. Name this remote debug configuration “gwt debug”.

For Intellij, your settings should look like this:


In Intellij, go to “Run -> Debug” and click the remote configuration that you created called “gwt debug”. Now, set a breakpoint in your application, open the application in your browser, and then watch the IDE stop on your breakpoint! Remember, the breakpoint must be under the “server” package!

Leave a Reply

Your email address will not be published. Required fields are marked *