Tuesday, February 14, 2012

Remote Debugging with Mule and Eclipse

One of my projects is still using Mule 2.2.1. I wanted to start it in debug mode so that I can do some remote debugging using Eclipse. I had already spent couple of hours before I could figure it out.

Mule 2.x
It needs a change in wrapper.conf file of Mule. There is a commented line
#wrapper.java.additional.=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

This line needs to be broken down into four lines one for each Java argument. Make sure it is replaced with proper consecutive number for wrapper.java.additional property in your file. They are 7,8,9 and 10 for me.


Make sure line given below is uncommented in Mule executable script  $MULE_HOME/bin/mule or it's counter part in $MULE_HOME/bin/mule.bat for windows
JPDA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

Mule 3.x
It's easier in case of Mule 3.x. Run mule with debug option $MULE_HOME/bin/mule -debug
By default it listens on port 5005 that can be changed in wrapper.conf
Eclipse Debug Configuration  
You can change debug port 5005 if you want and configure same in Eclipse debug configuration as it's explained in my another post Remote Debugging - Tomcat+Eclipse