Remote debug configuration for web apps

There are times when developers wants to debug unstable seha007 environment for bug fixes or investigation.

In order to debug server-side code you must start your (app) server in debug mode, and you must have your IDE connect to the remote JVM through a Remote Server Debug configuration (That’s what it is called in IDEA). Other IDE’s should have something very similar to this that will allow it to “hook” into the remote JVM and find out the calls that are being made, and to stop the code when it hits a breakpoint that you have set in the IDE.

For the same there are 2 requirements.

  1. Set up your server to start in debug mode and address a particular port
  2. Setup your IDE to lesson to a particular port and sense the break point.
  • Setup your server to start in debug mode to address a particular port

IPA and LMS are deployed on Tomcat at QA/DEV/Test/Production Environment.

There is one setenv.sh file located inside the $TOMCAT_HOME/bin/setenv.sh

You just need to add the below lines to the JAVA_OPTS variable in the file.

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,suspend=n,server=y

it will look like this 

JAVA_OPTS=”-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,suspend=n,server=y”

Save the file , and restart tomcat normally.

This time tomcat will run the debug mode at the port 8787.

You can also see in the tomcat logs a message like below.

Listening for transport dt_socket at address: 8787

  • Setup your IDE to lesson to a particular port and sense the break point.

Refer this screen shot for IDEA remote debug setting :

idea_remote_applicationdebug

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s