Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Remote Debugging Mule Application

DZone's Guide to

Remote Debugging Mule Application

In this article, we demonstrate how you can access and debug your Mule application remotely. Just image debugging while sipping Mai Thai on the beach.

· Performance Zone ·
Free Resource

Sensu is an open source monitoring event pipeline. Try it today.

Introduction

Occasionally, we have to debug a Mule application remotely, where the error condition is difficult to reproduce locally. The documentation on this is very scarce. This short post is to demonstrate how to do remote debugging.

Limitation

Currently, the remote debugging of Mule applications is not supported for the CloudHub application. 

Setup

Update wrapper.conf

# enable remote debugging
wrapper.java.additional.80=-Dmule.env=dev
wrapper.java.additional.81=-Dvault.key=Gary1234
wrapper.java.additional.82=-Dmule.debug.enable=true
wrapper.java.additional.83=-Dmule.debug.port=6767
wrapper.java.additional.84=-Dmule.debug.suspend=false

Line 2 is to declare the environment. In my application, I define a secure property placeholder. mule.env=dev indicates that mule.dev.properties will be loaded. Line 3 is the key to the vault.

Line 5 is debugging port.

 <secure-property-placeholder:config name="Secure_Property_Placeholder" encryptionAlgorithm="Blowfish" key="${vault.key}" location="mule.${mule.env}.properties" doc:name="Secure Property Placeholder"/>

Verify Opening Ports 

On the Linux server, execute the following commands:

lsof -iTCP -n -P| egrep LISTEN 

I can see the following:

java      16998 mule    4u  IPv4 430599484      0t0  TCP 127.0.0.1:32002 (LISTEN)
java      16998 mule   38u  IPv4 430596802      0t0  TCP *:37236 (LISTEN)
java      16998 mule   39u  IPv4 430596803      0t0  TCP *:2003 (LISTEN)
java      16998 mule   40u  IPv4 430596805      0t0  TCP *:45693 (LISTEN)
java      16998 mule  446u  IPv4 430603723      0t0  TCP *:7779 (LISTEN)
java      16998 mule  608u  IPv4 430603851      0t0  TCP *:6767 (LISTEN)
java      16998 mule  714u  IPv4 430599549      0t0  TCP *:9999 (LISTEN)
java      16998 mule  751u  IPv4 430609773      0t0  TCP *:18081 (LISTEN)

As you can see, I have an HTTP port (18081) open. This is my application's HTTP listening port. 6767 is the debugging port. 7779 is the mmc port.

Configure Mule Anypoint Studio

Right click on project

Image title

Remote Mule Application --> New_Configuration

Image title

Click 'Debug.'

Now debug is running. To very this, we can use the following command in the local environment:

gl17@Gary-Liu-17s-MacBook-Pro:~/.m2$ lsof -iTCP -P -n | egrep 6767
AnypointS 4718 gl17  121u  IPv6 0xf9dcc2212fc961c3      0t0  TCP 10.1.2.7:61271->10.10.0.35:6767 (ESTABLISHED)

As you can see, the connection has been established with remote server 10.10.0.35:6767.

I can invoke the service now. Before I run this, in my studio, I can see the following:

Image title

Note: if you look at the console in Anypoint Studio, there is no information at this point. And it will never show any information, as we connect to the remote server.

Once I invoke the service with http://snapip01:18081/xpo I can see the following:

Image title

Now I can walk through the code.

Take Away

The main purpose of this article is to demonstrate the procedure to set up remote debugging and how to check it.

The following commands are very useful:

lsof -iTCP -P -n | egrep 6767
lsof -iTCP -n -P | egrep LISTEN

Sensu: workflow automation for monitoring. Learn more—download the whitepaper.

Topics:
remote debugging ,mule runtime ,performance ,mule performance

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}