September 5, 2012

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 :-)

19 comments:

  1. Hi Bruno,
    I tried the above steps. I got till
    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.

    After this when I try to debug it gives me below error
    Failed to connect to remote VM. Connection timed out.
    org.eclipse.jdi.TimeoutException

    I have tried increasing the timeout and other things but of no use.
    Any ideas?
    I am using eclipse on clients Virtual machine

    ReplyDelete
    Replies
    1. The 'Failed to connect to remote VM' error can have different causes.
      1. Debug mode is not enabled. Have you enabled it? Did you restarted the app server?
      2. Eclipse is not able to connect. Is the hostname right? Try to ping it. Is the port right? Try to telnet on it.
      3. The connection is slow. Try to increase the timeout under Preferences - Java - Debug - Debugger timeout. The default is 3000 (3 seconds). Try setting it to 10 seconds.

      Regards

      Delete
    2. Have you change file? -
      c:\ibm\SMP\maximo\applications\maximo\properties\maximo.properties

      You must write row with current password of user "maximo"
      mxe.db.password=Passw0rd

      Delete

    3. Tag: PM203A57. Let me share all of you about #5 Tips for Project Management Success,, I hope you enjoy it

      1. Plan your day using time management techniques

      As a project manager, time management skills are essential because you are dealing with a wide range of tasks that demand a quick turnaround time. Planning your day will go a long way in keeping you organized and increasing your productivity. Assist your task planning by using project management software which helps you track the work of you and your team.

      If you are not very tech savvy, a simple to-do list can also be a great organizational tool. Prioritize your most important tasks by putting them at the top of the list and less important ones at the bottom. Having a visual plan of your daily tasks helps to keep you on track and aware of time.

      Related post: Free ebook 104 secrets to become a great project manager

      2. Include stakeholders in important project conversations

      While you will have plenty of responsibilities regarding the project, don’t neglect your clients.

      Good communication is essential is keeping both parties informed of project progression, curtailing scope creep, and apprised of changing requirements. Some clients may have different expectations when it comes to communication, so make sure to establish the frequency and type of communication (like emails, phone calls, and face-to-face conversations) at the beginning of your project.

      Establishing communication expectations early helps alleviate stakeholder uncertainty about communication frequency and delivery.

      3. Regularly communicate with your team

      Daily team communication helps keep misunderstandings and unclear requirements under control. Keeping your team informed in every step of the project is essential to project management success.

      For example, a study published by Procedia Technology found that good communication skills were the cornerstone of project management. The study examined over 300 “construction project managers, architects, construction managers, engineers and quantity surveyors” and their successes and failures on various construction projects.

      4. Anticipate project setbacks

      Even the best-laid plans often go awry.

      Remember that even with a high amount of planning and attention to detail, your project may still encounter some challenges. Pay attention to complaints from stakeholders or colleagues, and other warning signs, like a missed deadline or cost overrun, that there may be a problem.

      Preventing a crisis will keep your project running smoothly, save you a lot of time, and keep you, your team, and your stakeholders confident in progressing with the project.

      Unfortunately not every complication can be avoided. Crisis management skills are essential for dealing with the unexpected. Project managers need to be flexible and pragmatic. Improvise and make sharp decisions when needed.

      Related post: 92 free project management templates

      5. Stay focused on the details

      A common problem project managers encounter is having the project aims not aligned with the organization’s objectives. A great project manager will strategize a plan for the project to lead back to the overall success of the business.

      Know your project’s scope by heart and avoid wandering outside of the project’s requirements. It’s too easy to get lost in minor details and forget what your focus is, so a well-planned project scope is essential for success.

      And final, you should use KPI to measure effectiveness of the project, here are full list: 76 project management KPIs


      Delete
  2. Hi Bruno,
    Thanks for the quick reply.:)
    I have tried all the above three points
    1.yeah I have enabled debug mode and restarted the app server.
    2.Ping and telnet both were successful.
    3.I tried setting it till 50 sec but of no use.

    Any other ideas or mistake you think I might be doing are appreciated :)

    ReplyDelete
  3. Hi Bruno,
    Thanks for the help. The issue got resolved ,don't know how but now I can debug the application.
    I appreciate the effort you putting in this blog.
    Keep up the good work :)
    God bless you..

    ReplyDelete
  4. Nice work
    I will try it right now
    Keep up

    ReplyDelete
  5. Thank you Bruno!
    But you do not describe about connection property file: "C:\ibm\SMP\maximo\applications\maximo\properties\maximo.properties"

    May be you add this information in this article?

    ReplyDelete
    Replies
    1. I don't think there is any need to modify the maximo.properties to enable debug.

      Delete
  6. But, if not to insert this parameter "mxe.db.password=Passw0rd" connection can't be established. Isn't it?

    ReplyDelete
  7. Hello Bruno!, I'm trying to debug like you said, but I started debug and nothing happens, I mean, debug is running and I can suspend it, but that's all. Shouldn't it be showing the start page?.

    Thanks, and sorry my English!.

    Regards

    ReplyDelete
    Replies
    1. No it will not display and start page.
      You have to set a breakpoint and pass trough it using the web UI.
      For example if you have overrided the Workorder.add method you can create a WO from the UI and the application will stop at your breakpoint.

      Delete
  8. Bruno,
    Would love to thank you for being there for all of your followers.
    I got couple of questions for you:
    1- In Issue and Transfer app, why Maximo runs the Save method on each line as individually instead of dealing with the whole set at the same time, so what should I do if I want to update table in the DB just one time per transaction not per record.
    2- In Select Item for Return, the IssueTyoe is always Issue when it suppose to be Return..
    Thanks again for your support.

    ReplyDelete
  9. How can we debug the same by using weblogic application server?

    ReplyDelete
    Replies
    1. Yes you can.
      Try google something like 'weblogic debug eclipse'.

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. I have followed above steps.

    I am not able to understand how maximo or websphere will get to know about my custom class in eclipse. Which is a bean class on a button. I have applied breakpoints and now clicking the button. I cant see debug going on

    ReplyDelete
  12. I ma getting refused error.
    I can ping but I cannot telnet.
    Any idea what could be the cause?

    ReplyDelete