zmlocalconfig tomcat_java_options
This returns the current JVM options that we pass to Tomcat.
zmlocalconfig -e tomcat_java_options=" -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n"
(Remove spaces before "suspend=n". I have no idea why the forum app puts them there).
If you need to debug code that runs during server startup, specify suspend=y instead. Note that if you do this, server startup will hang until a remote debugging session attaches to it. Feel free to use a different port number if you like.
Restart the server and make sure you're still able to read mail.
On the client:
- Make sure that your source is synced to the same timestamp as the server build.
- In Eclipse, choose the Run / Debug... menu option.
- Choose Remote Java Application and click the New button.
- Set Name to "Remote", Host to the hostname and Port to 8000.
- Click Close.
Now if you ever need to debug the server, click on the down arrow next to the bug icon and choose "Remote". If you don't want to use Eclipse, connect to the server on port 8000 using any standard JDWP debugger.