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 set in your custom code or Mule’s source code suspends the execution and takes you to Eclipse’s Debug perspective.
You can start Mule with the -debug option to activate remote debugging as shown in this Linux example:
With this option, Mule starts normally with the only difference being the following message logged in the console:
Listening for transport dt_socket at address: 5005
Mule is now remotely 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 resumes its start-up sequence and soon you’ll be ready to step debug.