Month: June 2016

How to Connect with WSO2 ESB Server in Debug Mode

How to Connect with WSO2 ESB Server in Debug Mode

I have written a post before on WSO2 mediation debugger as “How to Debug WSO2 Mediation Flow” which guides through the basic steps to use WSO2 Mediation Debugger. It may not contain each and every detail because then it would be a one large post (which no one will read). ๐Ÿ™‚ ๐Ÿ™‚

This is a one of the posts in many to come which describes the WSO2 Mediation Debugger features in detail for users need more than the basic requirements. Here I will discuss about how to connect with WSO2 ESB Server in mediation debug mode.

PREREQUISITES

First we need to have the mediation debugger supported ESB distribution. WSO2 ESB 5.0.0 is the distribution packed with mediation debugger. You can download latest pack from here. (https://github.com/wso2/product-esb/releases/)

And also we need to have a debugger supported Developer Studio ESB Tool. You can follow this article to install the WSO2 ESB Tool 5.0.0. ( https://github.com/wso2/devstudio-tooling-esb/releases)

Some of you may confused in the previous post ESB Tooling version is 4.1.0 and now 5.0.0. We decided to change the Tooling version to 5.0.0 since it is the version of WSO2 ESB runtime. As you may already know from now onwards each wso2 product will ship with three components as runtime (WSO2 ESB server), tooling (WSO2 ESB Tooling) and analytics(WSO2 ESB Analytics). If we had different versions for these three components it may confuse theย  user to find the compatible versions to work together for the one product.

RMCfLEWgTJmandVGXcSG_Confused Superman

 

 

So now all three components will come under same version. (For ESB it is 5.0.0) ๐Ÿ™‚

OVERVIEW

 

There are two ways we could connect ESB tool with ESB server to deploy artifacts. They are we could start esb server from terminal by executing wso2server.shย  script in the bin folder and add to ESB tool as a remote server or we could add a esb as a wso2 server in the ESB tool and start.

We can debug the esb mediation flow in both above mentioned occasions.

Starting WSO2 ESB Server with Independently and Connect ESB Tool to Debug

We can navigate to server file location bin folder from the terminal and execute wso2server.sh as follows to start esb server.

startserverterminal

But to support mediation debugging we need to provide command line arguments as “-Desb.debug=super”.

Then the ESB server will listen on two ports to connect with Developer Studio ESB Mediation Debugger as configured in the [esbserver]/repository/conf/sypanse.properties file.

#configuration for the external debugger channels if server is started in debug mode
synapse.debugger.port.command=9005
synapse.debugger.port.event=9006

Then we have to connect esb tool with esb server by execution above created debug configuration. We have roughly 1 minute time span to connect, otherwise esb server will stop listening and start the server without connecting with debugger tool.

So we should first build the debug configuration from the WSO2 ESB Tool before starting the ESB Server in the debug mode.

Go to Debug Configurations in the ESB Tool and you will see a type of debug configuration named ESB Mediation Debugger

debugconfigclosemediationdebugger.png

Then double click on ESB Mediation Debugger and you will get configuration dialog as below.

defaultconfig.png

It will contain the default command port and event port as 9005 and 9006 with your local host name.

If you want to change the default ports, you should modify both server synapse.properties file and this configuration parameters.

And you can remote debug a server which is running in a different host by modifying the Server host with it’s ip.

Now start the ESB Server in the mediation debug mode with the command “sh wso2server.sh -Desb.debug=super” and click the Debug button when server listing to the ports as bellow.

listining.png

Then the server will be in the mediation debug mode and connected with ESB tool.

Starting WSO2 ESB Server with from ESB Tool and Connect to Server in Debug Mode

If you want to start esb server from esb tool and debug you need to give “-Desb.debug=true” argument to start the server.

First add esb server into ESB tool. Goto server view and create a new server.

serverview

selectESBserver

Actually ESB Server version is not much critical here, most important part is the Server runtime environment. It should be WSO2 Carbon 4.4 based server.

Then select WSO2 ESB Server 5.0.0 and give the esb server home folder location from the Add link.

browsetosetesbhome

Then finish the server configuration. This is the normal way to add a wso2 server for developer studio.

Now if we want to start esb server in the debug mode we have to provide the argument to server start up.So go to run/debug configurations and double click Generic server.

genericserver

argumentstab2.png

And go to Arguments tab and add Program arguments “-Desb.debug=super”. Apply the changes and finish the configuration.

Then start the server from the server view and esb server will listen to debug ports as we saw earlier.

Can We Remote Debug and Mediation Debug in the Same Time???

The answer is YES. You could start the esb server by giving the command

“sh wso2server.sh debug 5005 -Desb.debug=super”

It will first listen on the port 5005 to connect with esb source and then stop and listen to ports 9005 and 9006.

You can try ESB Mediation Debugger more and report the bugs and suggest improvements from the following link as JIRAs.

 

Advertisements