Debugging Outside Studio
To troubleshoot a Mule app in Anypoint Studio, you can use the Studio Visual Debugger. This lets you set breakpoints to stop execution and check events.
If you’re creating your Mule app outside of Studio, you can either use MUnit to test your app, or you can activate remote debugging.
MUnit is a Mule application testing framework that allows you to build automated tests for your integrations and APIs. It provides a full suite of integration and unit test capabilities, and is fully integrated with Maven and Surefire for integration with your continuous deployment environment.
For more information, see the MUnit documentation.
You can start Mule with the -debug option to activate remote debugging, as shown in this Linux example:
With this option, Mule starts normally and logs the following message in the console:
Listening for transport dt_socket at address: 5005
Mule is now remotely debuggable on port 5005. Follow these steps to debug Mule:
Access Eclipse, and select the the Run > Debug Configurations menu. From there, create a Remote Java Application configuration that uses port 5005.
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 you can debug the app step-by-step.
If you want to use a port other than 5005, change the JPDA_OPTS property file in the Mule startup script before following the steps for debugging Mule.