Debugging Outside Studio
In Anypoint Studio, you can use the Studio Visual Debugger to help you troubleshoot your app. If you’re creating your Mule app outside Studio, you can resort to the following options:
Select the "Debug As > Mule Server" start-up mode from your configuration file. Any breakpoint you will have set in your custom code or Mule’s source code will suspend the execution and will take you to Eclipse’s Debug perspective.
You need to start Mule with the -debug to activate remote debugging, which gives (on Linux):
1 $MULE_HOME/bin/mule -debug
With this option, Mule will start normally with the only difference being the following message logged in the console:
1 Listening for transport dt_socket at address: 5005
Mule is now remote debuggable on port 5005. Should you want to use another port or configure the JVM to ponder until a remote debugger gets attached, edit the mule start-up script that is relevant for your operating system and change the parameters found in the JPDA_OPTS property.
Switch to Eclipse and go the the Run > Debug Configurations menu. From there, create a Remote Java Application configuration. Ensure the port is 5005.
Also, in order to step debug with the source code attached, you need to add the source code of your Mule local instance as an external archive on the second tab of the configuration panel.
Click the Debug button at the lower right corner of the configuration screen. The local Mule instance will resume its start-up sequence and soon you’ll be ready to step debug.