Rapid Java class deployment on WebSphere

This entry is part of the Maximo Java Development series.

In this post I will describe how to minimize the time needed to redeploy the custom Java code in Maximo running on WebSphere during the development phase.

Note: The techniques explained in this article (except the first one) are recommended only for development environments.

Here are the four methods I know to perform this task (the last is the fastest).

Rebuild and redeploy (30 minutes)

The standard procedure of updating custom Java classes in WebSphere is VERY time consuming and consists of the following steps:

  1. Copy the custom Java classes under [SMPDIR]\maximo\applications\maximo folder.
  2. Rebuild Maximo EAR.
  3. Redeploy the EAR.

Use sync-websphere-maximo.cmd script (10 minutes)

There is a well hidden script named sync-websphere-maximo.cmd under [SMPDIR]\applications\maximo directory that takes the classes in the businessobjects, maximouiweb, mboweb, meaweb and lib directories and roughly copies them to the WAS MAXIMO.ear folder.
First of all you have to configure the script editing sync-websphere-maximo.xml file and set maximo.websphere.dir property.

  1. Copy the custom Java classes under [SMPDIR]\maximo\applications\maximo folder.
  2. Run the sync-websphere-maximo.cmd script.
  3. Restart Maximo application server.

Rapid approach (6 minutes)

A fast technique that I use is to directly copy java class files in the MAXIMO.ear directory under WebSphere tree. In a typical deployment it is located under [WSDIR]\AppServer\profiles\ctgAppSrv01\installedApps\ctgCell01\MAXIMO.ear.
The little trick is to use a good file archiver tool like 7-Zip to dynamically add/replace files in the businessobjects.jar file without having to extract and rebuild it.
This is the exact sequence to follow.

  1. Stop Maximo application server (do this before modifying businessobjects.jar file to avoid corrupting it).
  2. Copy the custom Java classes into MAXIMO.ear folder.
    1. If the class files belongs to maximouiweb module I just copy them in the maximouiweb.war\WEB-INF\classes directory.
    2. If the class files belongs to businessobjects module I open the businessobjects.jar file with 7-Zip (with a right click) and drag and drop the custom class files into the right folders.
  3. Start Maximo application server.

Super-fast approach (5 minutes)

The previous technique can be further improved with a little trick (thanks Diego for the tip).
First of all you have to force Websphere to load the unpacked businessobjects.jar:

  1. Stop Maximo application server.
  2. Go in MAXIMO.ear folder and unzip the businessobjects.jar file into a directory named businessobjects.jar.
  3. Rename the businessobjects.jar file (e.g. businessobjects.orig.jar)
  4. Start Maximo application server and check everything is ok.

After having performed this configuration you can copy your class files directly in the ‘exploded EAR’ with this procedure.

  1. Stop Maximo application server.
  2. Copy the custom Java classes into businessobjects.jar or maximouiweb.war subdirectories of MAXIMO.ear folder.
  3. Start Maximo application server.

Note that step 2 can be automated setting the Eclipse destination directory directly to businessobjects.jar directory (unchecking the ‘scrub output dir’ in the project options under Java – Compiler – Building). However this may worth a separate article…

Speed-of-light approach (seconds)

We can further improve the ‘super-fast’ approach leveraging the WebSphere automatic class reload (thanks to Bartosz).

  1. Stop Maximo application server.
  2. Go in MAXIMO.ear folder and unzip the businessobjects.jar file into a directory named businessobjects.jar.
  3. Rename the businessobjects.jar file (e.g. businessobjects.orig.jar)
  4. Change WebSphere configuration
    1.  Log into the WebSphere web console.
    2. GoTo “Enterprise Application” – MAXIMO – “Class loading and update detection”.
    3. Set “Reload classes when application files are updated” checkbox and set “Pooling interval for updated files” to 5 seconds.
    4. Ensure “Debug Mode” is also enabled on MXServer application server.
  5. Start Maximo application server and check if everything is ok.

After these changes you can modify java classes and if you would like to refresh classes on WebSphere server you only need to copy the file into the businessobjects.jar or maximouiweb.war folder. WebSphere will automatically recognize new classes and will reload them so you don’t need to restart Maximo application.
If you are using Eclipse to develop the changes you can create simple ant builder which will responsible for copying updated files to businessobjects.jar and maximouiweb.war folders.

Rapid Java class deployment on WebSphere
Share this post...

18 thoughts on “Rapid Java class deployment on WebSphere

  1. You can also avoid to unzip/zip the businessobjects.jar:
    0) stop WAS
    1) move businessobjects.jar to a temp directory
    2) in Maximo.ear create the directory "businessobjects.jar" (same name of .jar)
    3) unzip all the files of businessobjects.jar in the new directory
    4) start WAS

  2. Hi Bruno,

    Thanks for the post, its very helpful.
    But I'm not able to open the maximo.ear file.
    I've downloaded the FileViewPro from net, but it didn't work.

  3. I've set my maximo.websphere.dir value appropriately, and my changes classes seem to work, however I notice other errors that I do not get when I build the ear file.

    here are some errors I get:
    java.lang.reflect.InvocationTargetException

    [5/22/13 9:57:08:428 EDT] 00000056 SystemErr R at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:509)

    Caused by: java.lang.ClassNotFoundException: ilog.views.gantt.IlvResource

    Is there not some extra configuration you have to do to sync-websphere-maximo?

    For example, what about:
    <property name="maximo.businessobjectsclasspath"

    This property exists in buildmaximoear.xml as well…..should these not match? Should we be copying this property into sync-websphere-maximo.xml.

    In addition to the errors, I've noticed a few apps don't work: person groups does not load, Advanced workflow designer doesn't load completely…

  4. Hi bruno
    To add additional jars , can i just place it in \\Program Files\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\installedApps\ctgCell01\MAXIMO.ear\lib and restart the server.

    I want my email listener to look up this new jar

  5. I do have occasionally used the exploded businessobjects.jar technique to replace .class files on the fly.

    There is also an option when you are publishing the maximo.ear to check the classes for changes (it is in the first screen, where you put the application name, typically MAXIMO). When a change is detected, typically the application server is automatically restarted by WebSphere if my memory doesn't fail.

    Now I use hot deployment with Eclipse when developing, it's faster and doesn't require a restart of the app. server unless the "interface" for the class changes (signature of a method, implemented interfaces, names, etc.).

  6. HI Bruno, I am Facing a problem after i deploy the class file.I create two new fields in the workorder table and applied filed level customization on them .But once i o specify the class path to the corresponding attribute and the deploy the classes the two corresponding fields become readonly.
    Please help me through this

  7. Hi Bruno,
    Together with my colleagues we found some WehSphere modification which help to improve developing phase. Please read our suggested solution (The difference between your and our solution is in point no.4 ):
    Super-fast approach (~1 minute)
    First environment configuration:
    1. Stop Maximo application server.
    2. Go in MAXIMO.ear folder and unzip the businessobjects.jar file into a directory named businessobjects.jar.
    3. Rename the businessobjects.jar file (e.g. businessobjects.orig.jar)
    4. Change WebSpher configuration:
    a. Log into the WebSphere web console
    b. GoTo “Enterprise Applications” -> MAXIMO -> “Class loading and update detection”
    c. Set “Reload classes when application files are updated” checkbox and set “Pooling interval for updated files” to, for example, 3 seconds
    (Note: Check if “Debug Mode” is also enabled on MXServer)
    5. Start Maximo application server and check if everything is ok.

    After these changes you can modify java classes and if you would like to refresh classes on WebSphere server you only need to copy the file into the businessobjects.jar or maximouiweb.war folder. After that WebSphere will recognize that classes were changed and will reload application. In this scenario you don’t need to start/stop maximo application.
    If you are using Eclipse to develop the changes you can create simple ant builder which will responsible for copping updated files to businessobjects.jar or maximouiweb.war folder.

  8. Hi,
    Absolutely great article. I have used the supre-fast approach for a long time and now I tried the speed-of-light… works fine.
    But one note/question. Speed-of-light approach logs me out if there are new or updated classes. Are there anything that can be done to prevent this?

    Regards,
    Mikael

  9. Bartosz M,
    "After that WebSphere will recognize that classes were changed and will reload application. In this scenario you don’t need to start/stop maximo application."

    Maximo automatically restarts after you load new classes
    It is the same as if you load classes and manually restart the server (killing proccess). This process takes a couple of minutes, but not seconds as you pointed out in the article

  10. Soon as I replace the class file, I get a message in the logs
    WSVR0041I: Stopping EJB jar: mboejb.jar

    after which application stops and starts back which takes about 2 minutes, and of course I also get logged out. I've tried replacing businessobjects.jar and same thing happens. Is that normal or am I missing a setting to reach the 'speed of light'?

    by the way I'm working on a custom Cron Task file. Or does it not work on crontask files?

  11. I know this is an old thread and probably not being monitored anymore but can you speak to how effective the "Speed-of-light approach (seconds)" method will be with Java Class REMOVAL? We are doing some artifact removal and need to be deleting Classes and validating that our Automation scripts we are creating to replace the custom classes work. Will it work in the inverse of updating/adding classes as far as removing classes? Just checking otherwise thinking I need the build and deploy approach. Thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top