This page explains how to set up remote-debugging of ServiceMix using Eclipse.

Basically, you have to perform the following steps:

  1. Enable remote debugging in servicemix.bat

  2. Specify a remote-debugging launch configuration

  3. Start SM and switch to Debug-Perspective

Enable remote debugging in ServiceMix

You can debug ServiceMix or any application deployed onto it using remote debugging. Remote debugging can be easily activated by using the debug parameter on the command line.

> bin/servicemix debug

or on Windows

> bin\servicemix.bat debug

Another option is to set the KARAF_DEBUG environment variable to TRUE.

This can be done using the following command on Unix systems:

export KARAF_DEBUG=true

On Windows, use the following command

set KARAF_DEBUG=true

Then, you can launch ServiceMix using the usual way:




The debugging options can be modified in servicemix.bat via the DEFAULT_JAVA_DEBUG_OPTS. The default values are:

set DEFAULT_JAVA_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

This option works fine when it is needed to debug a project deployed top of Apache ServiceMix. Nervertheless, you will be blocked if you would like to debug the server ServiceMix. In this case, you can change the following parameter suspend=y in the servicemix script file:

export DEFAULT_JAVA_DEBUG_OPTS='-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'

and on Windows,

set DEFAULT_JAVA_DEBUG_OPTS='-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005'

That will cause the JVM to pause just before running main() until you attach a debugger then it will resume the execution. This way you can set your breakpoints anywhere in the code and you should hit them no matter how early in the startup they are.

Specifying a Remote Debugging Launch Configuration

Specify an Eclipse Remote Java Application debug launch configuration on the project you want to monitor.

  1. Open Run - Debug

  2. Mark Remote Java Application

  3. Create a New Launch Configuration

  4. Specify a name, the project you want to debug (e.g. servicemix-wsn2005) and the connection properties; In connection properties please change port from 8000 to 5005.

  5. Apply.

See for details.

Performing Debugging

  1. Add breakpoints/debug information to the relevant code inside Eclipse.

  2. Start ServiceMix.

  3. Start debugging with the previously created launch configuration.

  4. Switch to debug perspective.

  5. Exercise the error-causing behaviour.

  6. Wait for Eclipse to be notified of the breakpoints.