Wednesday, 26 February 2014

Debugging helps greatly in analyzing application state under specific scenario, we can verify its state and stepping through can be very useful in getting clear picture about how its state changes.

Debugging within Mule Studio:

Debugging within Mule Studio is very straightforward,
  • setup your breakpoint(s)
  • right-click on project then Debug As => Mule Application

There we go, it will start embedded Mule server with application and we are ready to debug...

Debugging Standalone Mule with Mule Studio:

If we have a standalone Mule server and we are looking to debug, following steps are required:


Mule Server

Start standalone mule server with –debug switch, it will enable remote debugging at default port 5005 (it is configurable but we’ll stick with it for simplicity)
mule –debug

Mule Studio

  • Open Mule Studio
  • Goto Debug Configurations



  • Create new Remote Java Application configuration
    • Select relevant project
    • Make sure Port is 5005 (if you haven’t changed the default)


    • Select tab ‘Source’ and Add src folder location

    • Press ‘Apply’ to save changes

  • Start standalone Mule instance with debug
  • In Mule Studio, goto this newly created configuration and press ‘Debug’

At this point Mule Studio will connect to port 5005 and flow execution will stop as soon as it hits one of the breakpoints allowing us to analyze closely.  One important thing I like to mention here is that we need to keep the sources sync with the deployed application otherwise it may result in flow stopping at unexpected instructions.

References:

  1. http://www.mulesoft.org/documentation/display/current/Step+Debugging