Remote Debugging in Eclipse
Start server in debug mode
The Tomcat server on which you wish to debug needs to be restarted in debug mode. This operation needs to be performed by the Configuration Manager. To start Tomcat in debug mode, set the JAVA_OPTS variable in the tomcat configuration file (tomcat6.conf) like this:
JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n”
This tells the JVM to open port 8000 so that an external application such as Eclipse can connect for debugging purposes.
Ensure that the debugging port is open on the firewall.
The System Admin may need to open the debugging port (port 8000 in this case) on the firewall. In a load balanced environment such as UAT or SUP, the port should be open for all servers in the environment.
Configure Eclipse
Open the Debug Configurations dialog...
Click the arrow to the right of the debug icon and select "Debug Configurations".
Create a new Remote Java Application configuration
Click the "New" button (upper left corner of the left panel).
Fill in the Name, Host, and Port
a. Enter a name for this configuration.
b. Enter the hostname of the remote server.
The host name must be the real hostname of the server you are debugging, not a virtual DNS name. For example, the real hostname of dev.kfs.uconn.edu is kfs1.uits.uconn.edu. If you need to debug in a load balanced environment (SUP, UAT), you still need to use the real hostname. Since you don't know beforehand which server you will be connecting to, it is best to create a remote configuration for each server. The CM should have started both servers in debug mode, and the firewall ports must be open for all servers in the environment.
c. Enter the port number that the remote server is using for debugging (8000).
d. Click Apply.
Start Debugging
Click the Debug button. You should status message say "Launching ..." briefly. If you receive an error like "Connection Refused", check that the server is in debug mode and that the firewall ports are open.