How to debug Maximo/TPAE

This entry is part of the Maximo Java Development series.

Debugging is a great aid in developing Maximo/TPAE customizations in Java. This powerful technique, albeit simple, is too often ignored or neglected by less experienced developers. In this tutorial I will show how to connect Eclipse to a remote Maximo server in debug mode.
Here we go.

Enable debug mode in WebSphere

First thing to do is to enable debugging of the MXServer application server in WebSphere.
Open WAS console and find the MXServer application server under 'Servers' group.

Click on the MXServer link and search for the 'Process Definition' under the 'Java and Process Management' group on the right side.

Now click on 'Java Virtual Machine' on the right and search the 'Debug Mode' checkbox. Check the 'Debug Mode' flag and take note of the debug port on the text box below (7777).

Now restart MXServer and you are ready to debug.

Attach the Eclipse debugger to MXServer

Launch Eclipse and open your Maximo Java project. I hope you have one:-)
Click on the drop-down arrow next to the Debug Menu button and select Debug Configurations.

Select 'Remote Java Application' then click on the 'Add' button on the upper-left and fill the Connection properties with the hostname of the Maximo application server and the debug port as configured in WebSphere.

Click on Debug button.
Now the Debug perspective should open automatically. If not, select Window > Open Perspective > Other > Debug. You should see something like this in the Debug view.

Now you are ready to debug. Try to put a breakpoint in your custom code and see what happens.
A mayor advantage of debugging is that you can hot-swap your code changes into the application server. All you have to do is to save the Java class and Eclipse will automatically compile and replace it in Maximo as long as you are connected.
Unfortunately this not always work and sometimes you get the following error.

In such cases, you have to stop the application server, replace the class tree and start over.

This technique, paired with the Rapid Java class deployment on WebSphere, can greatly speedup your job leaving some free time to go on Facebook :-)

Labels: , , ,