OK, this tutorial isn’t exactly rebuilding and redeploying EAR files, but if you are developing and writing some custom java classes for use with some extra fields or whatever, you will know what even if you make a single code change within Eclipse, you will have to move the .class file to maximo and manually rebuild and redeploy the whole maximo.ear file for just one simple change. And if you have deployed ear files, it can literally take up to 5 minutes for the whole process to complete. This is certainly a big pain in the ass when doing development work. So here is what I do to quickly deploy maximo java classes with WebSphere without having to actually go through the whole rebuild and deploy process.
The first thing we need to do is to stop the Maximo application server within WebSphere. Once stopped you can go into your WebSphere application server installed apps folder. You can find this here:
In this directory, you will see all the installed apps and one of them should be called MAXIMO.ear. If you open that up, you will see a file called businessobjects.jar. This jar file the one that holds all of the maximo java class and any custom java classes you may have written. So our basic goal is to recreate this businessobjects.jar file with our newly modified java class.
First thing we wanna do is create a backup of this file in case something goes wary. Next, change the extension from .jar to .zip and you can use windows to extract the contents of the file to a folder called “businessobjects”. Open this folder and you will see a nice little structure of all the java class maximo uses. This is where we will add our java class to. In our case, we will create a new folder called “interpro” and under that we will create a folder called “app”. This folder is basically a replicated structure of the “psdi” folder but we called it “interpro” because it is our very own custom classes that we have built. So let’s say we have created a custom class for the workorder object, now under the “app” folder, we will create a folder called “workorder”. In this workorder folder is where we will paste our custom class called “FldWOLocCust.class”. So now your businessobjects folder should look something like this:
Now the next step is to jar up this whole businessobjects folder. To do that, open up your command prompt and navigate to this “businessobjects” directory. Now we will run the jar command from the command line in this directory. You should have a jar.exe file located in this directory:
So in the command prompt, enter this command to create a new businessobjects.jar file:
"C:/Program Files/IBMWebSphere/AppServer/java/bin/jar" -cf businessobject.jar *.*
Let it do it’s thing and when it’s completed, you should have a file called “businessobjects.jar” within your businessobjects folder. Copy this .jar file and paste it in your MAXIMO.ear directory. Remove any references to any other businessobjects.jar file and folders just in case.
Now, all you have to do is restart the Maximo application server within WebSphere and there you have it. Your custom java class is ready to use. When you make changes to your java class, just rinse and repeat. This whole process over the long run will save time and the headache of doing it the other way.