Remote Debugging Client Side GWT Code

A while ago I had to remotely debug client side code of a GWT application already compiled and deployed  onto a server. After searching around and reading this document a few times, I finally managed to do it following these steps:

  1. Compile and install the application on the server and write down the URL (like http://remote.host:8080/myapp/index.jsp).
  2. Create an Application launcher (Run->Edit Configurations->Applications in IntelliJ).
    • Set the main class to: com.google.gwt.dev.DevMode
    • Put this line in the program arguments: -noserver -war target/myapp -logLevel DEBUG -startupUrl http://remote.host:8080/myapp/index.jsp -port 8080 my.package.myapp.Module
  3. Debug this new run configuration. This will run the GWT Dev Mode and enable you to set breakpoints on the client side code.
  4. Copy and paste URL provided by Dev Mode into your browser (like http://remote.host:8080/myapp/indexjsp?gwt.codesvr=127.0.0.1:9997). You will need to modify Dev Mode extension options to allow this new combination (of app server and code server). On Chrome, for example, you can do this by clicking on the greyed out Dev Mode logo if you get an error.
  5. Remotely debug the server in the normal way (JDWP) to be able to debug server-side code as well.
Advertisements