Remote Debugging using Xdebug for Midtier

Hi there, I just solved an issue for Java application debugging in Tomcat. Currently I’m doing a custom application for BMC Remedy that run in Apache Tomcat as where the Midtier is deployed. Yap, I’ve merged the project into Midtier deployment folder. Apache Tomcat for BMC is well designed to run automatically in Microsoft Windows Services. That’s why I can’t debug the project. Because Tomcat needs jpda or Xdebug for debugging process. And to use them I need to set up the parameter in Catalina and run manually.

The bad news is Windows Services starts up the Tomcat by default using tomcat7w.exe that will override Catalina’s parameter. So, the conclusion are :

  1. Setup the Xdebug for Catalina OPT
  2. Turn off or disable the service
  3. Run Catalina.bat manually to start up

The 1st step :

  1. Create setenv.bat under Apache Tomcat installation folder if it is does not exist. In example C:\Program Files\Apache Software Foundation\Tomcat7.0\bin
  2. Put this line inside setenv.bat file
set CATALINA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=[your port],server=y,suspend=n

The 2nd step :

  1. Turn off and disable Apache Tomcat Service under Windows Services (services.msc)

The 3rd step :

  1. Run C:\Program Files\Apache Software Foundation\Tomcat7.0\bin\Catalina.exe start

Voila, Remote Debugging is ready to use! Just make sure your port setting in our 1st step is correct 😀


Leave a Reply

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

You are commenting using your 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