So, what is the best way to customize the classloader policy for an EAR application? we can consider 4 options.
You can choose any of the option according to your business needs.
But the best thing would be found out a solutions to application specific and set at EAR application project level so that any topology can suite your solution.
So here the best approach I think, create a deployment.xml file and put it in the EAR application root level.
<?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_124111296412322">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_23423402344" startingWeight="1" warClassLoaderPolicy="SINGLE">
<classloader xmi:id="Classloader_23432543596" mode="PARENT_LAST"/>
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_12411129640345" startingWeight="10000" uri="yourwarproject.war">
<classloader xmi:id="Classloader_12411324234"/>
</modules>
</deployedObject>
</appdeployment:Deployment>
You can use any method to package your application, you can generate/copy deployment.xml via ANT or any tool.
<ear destfile="${artifactsDir}/${earName}.ear" appxml="${projectName}_EAR/application.xml">
<fileset dir="${artifactsDir}" includes="${yourwarproject}.war"/>
<fileset dir="${projectName}_EAR/" includes="deployment.xml"/>
</ear>
- Change class loader policy to PARENT_LAST after every deployment from administrative console
- Set the server profile setting to use a PARENT_LAST classloader policy for all apps. However this might not be a POLICY for all of the app deployed in WAS.
- Write and execute a jython script after every publish to set the classloader policy.
- Create deployment.xml using RSA deployment descriptor editor J2EE plugin tool
You can choose any of the option according to your business needs.
But the best thing would be found out a solutions to application specific and set at EAR application project level so that any topology can suite your solution.
So here the best approach I think, create a deployment.xml file and put it in the EAR application root level.
<?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_124111296412322">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_23423402344" startingWeight="1" warClassLoaderPolicy="SINGLE">
<classloader xmi:id="Classloader_23432543596" mode="PARENT_LAST"/>
<modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_12411129640345" startingWeight="10000" uri="yourwarproject.war">
<classloader xmi:id="Classloader_12411324234"/>
</modules>
</deployedObject>
</appdeployment:Deployment>
You can use any method to package your application, you can generate/copy deployment.xml via ANT or any tool.
<ear destfile="${artifactsDir}/${earName}.ear" appxml="${projectName}_EAR/application.xml">
<fileset dir="${artifactsDir}" includes="${yourwarproject}.war"/>
<fileset dir="${projectName}_EAR/" includes="deployment.xml"/>
</ear>
No comments:
Post a Comment