Environment: OS - Ubuntu-10.04(Lucid Lynx)
IDE - IntelliJ Idea 10.0.2
Are you a new contributor to Apache Axis2 ? If yes then you will need to run Axis2 in debug mode to perform remote debugging to understand the source code at the beginning. It is easy to run Axis2 in debug mode. In this post I am going to explain how to do remote debugging Apache Axis2 source code with IntelliJ idea.
checkout and build the Axis2 trunk
First thing we need to do is checkout Axis2 source code from trunk. Then you can build it, and if you have any difficulty of building Axis2 trunk read my previous post Apache Axis2 Server: A Developer Guide To New Contributors .
Open Axis2 in IntelliJ Idea
Go to the root directory of your Axis2 source code and type "mvn idea:idea" now you can open it in IntelliJ Idea by going to File--> Open Project.
Configure Idea for remote debug
In Idea go to Run-->Edit Configurations or click the drop down menu icon in between Run and Makefile icons and select Edit Configurations.
Figure 1: select Edit Configurations |
Then Run/Debug Configuration window will display,
Figure 2: Run/Debug Configurations |
Now press the + button in top left corner of the window to create a new configuration based on default settings. Then select Remote in "Add New Configuration" window as shown in Figure 3.
Figure 3: Add New Configuration |
Provide a name to the remote debug session. In here you have to configure a few parameters
host : localhost
port : 8000 - Axis2 default debug port
module : module to remote debug or select <no module> to search across the whole project.
In here i have selected axis2-adb module.
Figure 4: set configuration |
Remote Debug
Great! now you are ready to do remote debugging in axis2-adb module, run "sh axis2server.sh -xdebug" in terminal then click debug icon in Idea. Before that make sure you have selected Axis2-adb in debug configuration, If so it will show "connected to the target vm address. 'localhost:8080' transport,'socket'" in debug console which means you have successfully connected :)
Figure 5: select Axis2-adb |
Now mark a break point inside invokeBusinessLogic method in RPCMessageReceiver class in adb module. Run your client code to invoke deployed Pojo service. The IDE hits and stops in that break point so you can debug step by step.
Note: If you get 'x' mark in debug point that means the source code is differ from your running code. In this case you should build adb module and replace axis2-adb-<version>.SNAPSHOT.jar and start debugging again.
You can find how to build and where to replace axis2 jars in "Run Axis2 with changes we have done to the source code" section in Apache Axis2 Server: A Developer Guide To New Contributors post.