September 30, 2010

Quick Maximo Development Environment Setup

This entry is part of the Maximo Java Development series.

This is the quickest and simplest procedure that I know to setup an Eclipse environment to develop Java customizations for IBM Maximo products.


Eclipse Installation

The first step is to install Eclipse on the development system.
Download Eclipse 3.5 from Eclipse website.
Extract the downloaded zip file into a local folder (e.g. C:\Eclipse).


Java Runtime Environment

Eclipse requires a Java VM to run. If you try to launch Eclipse (C:\Eclipse\eclipse.exe) and you don't have a suitable JVM installed you will get the following error.


The best approach is to use the Java Virtual Machine (JVM) embedded in the application server in which Maximo runs. This ensures that you are using the right version of JRE.
The JRE must be copied into C:\Eclipse\jre. For WebShpere application server it is located in [WebSphere]\AppServer\java\jre folder.
After this, try to execute C:\Eclipse\eclipse.exe to ensure that everything is ok.


Configuring Eclipse for Maximo development

The right Java compiler must be selected:
  • Maximo 6: Java 1.4
  • Maximo 7: Java 1.5
  • Maximo 7.5: Java 1.6
Set it in Eclipse preferences: Windows > Preferences > Java > Compiler > Compile compliance level.



Project Setup

Create an empty Java project.

Extract [SMPDIR]\maximo\deployment\default\maximo.ear into a folder named maximo in your workspace.
Refresh project tree in Eclipse (F5).

Add the following jars to the project classpath: Project > Properties > Java Build Path > Libraries > Add Jars.
  • maximo/lib/*.jar
  • maximo/businessobjects.jar

Create a class named AssetCust in src\custom\app\asset (package custom.app.asset) and paste the following code into it.

package custom.app.asset;

import java.rmi.RemoteException;

import psdi.app.asset.Asset;
import psdi.mbo.MboSet;
import psdi.util.MXException;

public class AssetCust extends Asset {

  public AssetCust(MboSet ms) throws MXException, RemoteException {
    super(ms);
  }

  public void save()throws MXException, RemoteException {
    super.save();  
    int id = getInt("ASSETID");
    String desc = getString("DESCRIPTION");
    System.out.println("Saving Asset ID=" + id + " desc=" + desc);
  }
}

The custom Mbo class gets quickly compiled and is ready to be deployed on your Maximo server.


AppBean development

If you need to develop application customization you need to add some more libraries to your project classpath.
The first one is the j2ee.jar file which can be found in [SMPDIR]\maximo\applications\maximo\lib folder.
The second library must be built manually. If you go in the folder where you extracted the maximo.ear file, you will see a maximouiweb.war file. Extract this file (it is a zip file) to a directory named maximouiweb. Refresh project tree in Eclipse (F5) and include maximouiweb.war\WEB-INF\classes class folder to your classpath.

39 comments:

  1. Nice description, thanks!

    ReplyDelete
  2. Hi Bruno, This is indeed a quicker way. However, when attempting to add the jar libraries
    << Project > Properties > Java Build Path > Libraries > Add Jars.
    maximo/lib/*.jar
    maximo/businessobjects.jar>>
    there are none visible. Any thoughts? Thanks in advance for all useful posts.

    ReplyDelete
  3. Have you extracted the maximo.ear into a folder named maximo ?
    Remember to refresh project tree in Eclipse selecting the project and pressing F5.
    Otherwise try to select the project properties, Java Build Path, Libraries, Add External Jars...

    ReplyDelete
  4. Hi Bruno, what about the server that will run this application ?
    I mean what about the compilation process ?

    ReplyDelete
  5. I'm not sure to get your point.
    However, I personally do the following steps to update Maximo server with the new code:
    1. Stop the Maximo application server
    2. Open the businessobjects.jar located into WebSphere (not SMP) with a zip file manager (I personally use 7Zip)
    3. Copy and paste the updated class files from the Eclipse bin folder into the right path in 7Zip
    4. Close businessobjects.jar
    5. Start the Maximo application server

    This process is much more faster that redeploying the maximo.ear.
    However, I suggest to use it only for development purposes and to follow the documented process for production environments.

    ReplyDelete
    Replies
    1. How to get the Maximo application server??
      Can you pleas provide the link to download.

      Delete
    2. Hi Bruno,

      I want to know what risk and any factors involved to not have hot deployments on production Websphere , can highlight any critical ones
      I know for sure one is if we manually copy/edit jars/classes there is chance of corrupting it
      and other one is many of Websphere wsadmin restore and other commands may not work properly if manually changed configurations files , app files

      Delete
  6. Thank you Bruno for your answer,
    just another question please : I'm currently involved in a project to add a module in IBM Maximo (may contain an application to administer the customers and invoices ... applications that Maximo didn't offer)
    Can you please give me a general procedure to follow to succeed my project.
    thank you very much Bruno.

    ReplyDelete
  7. I personally clone one of the existing applications starting from the one that is similar to what I need.
    Then I clean the new application as much as possible deleting all tabs, sections, tables and fields that I don't need.
    Then I start to add my own custom content.
    The Application Designer is not the best editor in the world but is useful especially in the setup of panels. Some fine tuning can be also made exporting, modifying and importing back the application XML definition.
    The Application Developer Guide is a must. You can download it here: http://publib.boulder.ibm.com/infocenter/tivihelp/v3r1/index.jsp?topic=%2Fcom.ibm.mam.doc_7.1%2Fmam_welcome.htm
    One last suggestion... export and backup frequently all the intermediate versions of the application XML definition.

    ReplyDelete
  8. Hi i use this plug in and it is more than enough for me

    http://maximodeveloper.sourceforge.net/Manual.html

    ReplyDelete
  9. where can i get the maximo source code to start with it
    did we get it freely as i move my carrer towards maximo
    need source code to configure project freely please do help me
    in this regard

    ReplyDelete
    Replies
    1. Maximo is not OpenSource!
      You cannot have its source code unless you work in IBM :-)
      As far as I know there is not downloadable trial version of Maximo so you to have a valid license to download and install it.
      Then you can get the maximo.ear file.

      Delete
  10. Hello, thanks a lot for nice "How-to".
    I have some uncommon situation. I need to write class than extends "psdi.webclient.system.beans.DataBean". Than class can be located at "maximo.ear\maximouiweb.war\WEB-INF\classes\psdi\webclient\system\beans\". But when i trying to create new one and set superclass "DataBean", eclipse cant find that class. Can somebody help to resolve this issue?

    ReplyDelete
    Replies
    1. DataBean class is not located into businessobjects.jar.
      The described procedure is only for MBO development.
      If you want to develop app beans you need to include the classes located under [SMPDIR]\maximo\applications\maximo\maximouiweb\webmodule\WEB-INF\classes
      I typically zip this folder and rename it tp maximouiweb.jar. Then I include this jar in the project classpath.

      Delete
    2. Hi,

      I tried your approach zipping the folder and rename to .jar but it is not working? It would be great if you can be more details?

      Thanks.

      Delete
    3. I have added a new paragraph 'AppBean development' at the end of the article.
      It should work.

      Delete
    4. Thanks for the great content. I can't seem to drop AppBean Class changes into 7Zip (maximouiweb.war) as I can with MBO changes. Is there a trick to get around this? Or does it required an EAR rebuild?

      Delete
    5. The uiweb.war is not compressed.
      Just put your classes in maximouiweb.war\WEB-INF\classes folder.

      Delete
    6. Aha, too simple. thanks for your time.

      Delete
  11. Hi Bruno,

    Suppose I use an outside API(using their jar) for processing something in cron. Where in server exactly should I place this jar so that this api is available for the cron server at run time

    ReplyDelete
    Replies
    1. I see two options:
      1. Add your jars into [SMPDIR]\maximo\applications\maximo\lib. Rebuild and redeploy the Maximo EAR.
      2. Add your jars to Maximo classpath into Application Servers > Maximo Server > Server Infrastructure > Java and Process Definition > Process Definition > Additional Properties > Java Virtual Machine > Classpath.
      Please let me know which one works.

      Delete
  12. Hi Bruno,

    I am new in Java customization. Whenever I compile your code in Eclipse it's throwing the below errors. Could you please tell me what will be the Main class in your source which you have mentioned in this article ? One more thing I am using Maximo Developer Plugin in my eclipse.
    Thanks in Advance.

    Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.log4j.LogManager

    ReplyDelete
  13. Hi Bruno,

    I'm new in Maximo Developer. But when I install the plugin in Eclipse and try to navigate to the source folder in Maximo view by click "Mbos Presentation" I have this Error " Connection to database not present, could not initialize Maximo developer ". So what the is the solution and what kind of Eclipse must to use "Helios, Galileo, Indigo or what".

    Thanks in Advance.

    ReplyDelete
    Replies
    1. I don't use Maximo developer. Just plain Eclipse.
      Actually working on Eclipse Juno.

      Delete
    2. make backup of maximo.properties
      and try to set mxe.db.password=
      and delete mxe.encrypted=true and delete encrypted password

      I used "Maximo developer", and this helped me.

      Delete
    3. Thanks,
      But Андрей Батыренко I try what you explained but it didn't work for me
      please explain more and what value I set to (mxe.db.password= ?)

      Delete
    4. Thanks,
      It Done after applied the steps that Андрей Батыренко explained but the missing step is to rebuild the maximo.ear file and republish the ear file on the server. thanks again but I have another issue that how can I see the source code and edit in a class methods that is under psdi folder, for example how can edit in Asset class.

      Delete
    5. In "mxe.db.password=" you must enter password for user from which maximo connect to database. You specified it on installation step.

      Delete
    6. You will not have or see the IBM out-of-box *.java source codes since they are IBM's property and not open source.

      Delete
  14. Hi Bruno,

    I did customization , how I can create maximo war from eclipse ?.
    Thanks in Advance.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. hi Bruno....nice description....
    * Is there any document to learn about maximo development(MBO,Field class etc)

    ReplyDelete
    Replies
    1. All the free resources I know are listed here: http://maximodev.blogspot.com/p/java-customization.html

      Delete
  17. Hi, Bruno!
    The Eclipse package ("Galileo package") from the link to "Eclipse website", that you posted, doesn't work with JRE 1.6.
    When I try to launch eclipse.exe, it throws error that some components need jre 1.5.
    Then I've followed by the link "Eclipse IDE for Java Developers" from the page:
    http://www.eclipse.org/downloads/
    dowload that package (actually it's the "Kepler package"), and now it works.
    Are there critical differences between these packages "Eclipse IDE for Java Developers", that could broke our classes? (Kepler Packages, Juno Packages, Indigo Packages, Helios Packages, Galileo Packages, Ganymede Packages, Europa Packages).
    How should I choose the "right" package?
    I work with Maximo 7.5 on WebSphere 7.
    Thanks in Advance.

    ReplyDelete
    Replies
    1. I use Juno for Maximo 7.1 and 7.5 without any problem.

      Delete
  18. where can I find the smpdir pls. I can't understand this part. thank you

    ReplyDelete
    Replies
    1. @sandra sio : it depends on which folder your installation has been done.. basically you find the SMP directory in
      E:\IBM
      or
      C:\IBM
      or
      E:\Program files \IBM

      hope that helps.

      Delete
  19. This comment has been removed by a blog administrator.

    ReplyDelete
  20. Hi Bruno, i followed all the instructions mentioned above. i started the MXServer. what changes do i expect from the custom Asset script class we did? thanks!

    ReplyDelete