2
votes

I've converted an application to be built and deployed with Maven instead of RAD's built-in tools. It's mostly gone well, but the last "gotcha" is that the application needs a class loader policy of "parent last/application". I'd like to automate this because currently, when I use the WAS plugin for Maven, it seems to uninstall and reinstall the application completely, and so I have to go through the admin console every time the code changes and the application is redeployed. If I could have the class loader settings built in to the deployed EAR, work would go much faster.

From what I can tell, class loader configuration is controlled in a RAD-managed file, "deployment.xml" which is located in my EAR project's "META-INF/ibmconfig" folder. I am guessing that I can include this directory structure in my EAR and it will work fine when it's deployed to WebSphere, but I'm more concerned about the contents of this file. It looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1460348645719">
  <deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1460348645719" startingWeight="10" warClassLoaderPolicy="SINGLE">
    <modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1460348645719" startingWeight="10000" uri="MyWarProject1.war"/>
    <modules xmi:type="appdeployment:EJBModuleDeployment" xmi:id="EJBModuleDeployment_1460348645719" startingWeight="5000" uri="MyEJBProject1.jar"/>
    <modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1460348645720" startingWeight="10000" uri="MyWarProject2.war"/>
    <classloader xmi:id="Classloader_1460348645719" mode="PARENT_LAST"/>
   ...

All of the modules in the application have IDs such as EJBModuleDeployment_1460348645719, and I'm guessing these were created when the application was originally published to WAS via RAD. If I give the new Maven-ized project to a new developer, would they be able to use this deployment.xml file or are there parts of it that are specific to a particular WAS instance that are usually managed by RAD?

Also, if I add more modules to the application later on, how would I generate new module IDs with Maven? Can I just make up an ID, like EJBModuleDeployment_123 or is this something that really should be managed by RAD/WAS? I was also wondering if I could write a Jython script to do this and somehow integrate that with Maven, but I'm not sure if that would work or if it's even necessary.

1
Regarding the numbers in the ID ("Can I just make up an ID, like EJBModuleDeployment_123 or is this something that really should be managed by RAD/WAS?"), you can use whatever you want (this is true for at least WAS 7.0 & 8.5.5)butallmj

1 Answers

1
votes

I usually deploy my apps with maven and then run wsadmin scripts (Jython) to change configuration info such as this (Class loader policy, Shared Libraries etc).

I run the maven job and wsadmin scripts togehter via Jenkins job so that they are performed together.