Remote Debugging Tomcat Servers

The ability to remotely debug an application running in a Tomcat environment can be quite helpful when trying to troubleshoot environment-specific problems. This document will tell you how to configure your server to allow remote debugging and attach to it using Eclipse or IntelliJ.

Configuring Your Server

In order to attach a debugger to your server, you first need to configure your server to allow debug connections. To do this, you'll need to modify the JVM args for your server, which can be done by editing the file which is in your deploy project (under src/main/resources). Add the following line:

continuous.jvmarg.debug=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7007

This will enable debugging for your continuous environment. You can change to 'continuous' to another environment if you need to debug in a different environment. NOTE: Debugging generally should not be enabled for public-facing environments.

Once you've edited this file, you'll need to do a deployment and make sure tomcat gets restarted so the new JVM arguments take effect.

Enabling debugging via the Tcat console

You can also enable debugging via the Tcat console. This is useful if you just want to temporarily enable debugging or don't want to go through the build and deployment process to enable debugging. Here are the steps for enabling debugging via the console:

1. Log into the Tcat console.

2. Navigate to the server you want to enable debugging on. Click on the 'settings' tab, then click the 'Edit Server Info' link on the right-hand side:


3. In the Environment Variables section, you should see an entry for 'JAVA_OPTS'. Click on the value for that entry and it will turn into a text box. You can paste the debug arguments into that box (-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7007).


4. Click Save, then restart tomcat on the server. Your server should now be setup for remote debugging.

Attaching with your IDE

Once your server is configured to run in debug mode, you'll want to attach your IDE to it so you can start debugging. You'll need to know:

  • The host you are connecting to. If you are going through a load balancer, try to get the IP or host of one of the nodes and hit that with your browser - it makes it easier to make sure you are hitting the same node you are debugging against.
  • The port the debugger should listen on. In our example above, it is 7007.


1. Open the Debug Configurations window (Click on the Debug icon, then choose Debug Configurations...)

2. In the list of options on the left, right-click on 'Remote Java Application' and select 'New'.


3. Choose the project you want to debug, then fill out the Host and Port info (see below for an example).


4. Click Debug. You should now be able to remotely debug your application like you would locally.


1. Open the Edit Configurations window, then add a new Remote configuration:


2. Choose the module (probably not required) and specify the host and port (see below for an example).


3. Select your new configuration. You should now be able to remotely debug your application like you would locally.


1. Select from the menu, Debug > Attach Debugger..., to open the Attach dialog

2. From the Connector options, select SocketAttach

3. Specify the host and port and click OK. You should now be able to remotely debug your application as you would locally.


This page was last modified on 4 June 2012, at 13:49.

Note: Content found in this wiki may not always reflect official Church information. See Terms of Use.