Services: Training Services | Consulting Services
It is quite easy to find information on how to allow an EAR to contain class-load configuration for JBoss and WebLogic, but with WebSphere it is not so obvious.
You can use the IBM Application Server Tookit (ASTK) currently at version 6.1, which can be downloaded from IBM. This toolkit is used by admins to package-re-package EAR file and is based on Eclipse, just like RAD (Rapid Application Developer)
As of Version 6, server-specific configurations for WebSphere Application Server are set in the WebSphere administrative console. You can use the Enhanced EAR editor to set the configuration settings specific to an enterprise application. The Enhanced EAR editor is available on the deployment page of the ASTK’s Application Deployment Descriptor editor. Use this editor to configure the following elements that are specific to an enterprise application.
· data sources
· Resource adapters and connection factories
· Substitution variables
· shared libraries
· virtual hosts
· class loader policies
Here is a table of files that you can use for "Extended Deployment" ie an "Extended EAR"
Note: When you enhance an EAR with the above configurations, several XML files are added
to your EAR directory.
Let’s Try an create an Ear using the ASTK and see what files transpire for class loaders being changed from the default.
Below I set the Class loader Mode of the Application to be PARENT_LAST and the WAR class loader policy to be APPLICATION.
After setting the class-loader policy the following structure is create in the EAR file.
We can see that the EAR project now contains a set of files as shown above and the deployment.xml file specifically contains:
?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_1297859327856">
<deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1297859327856" startingWeight="10" warClassLoaderPolicy="SINGLE">
<classloader xmi:id="Classloader_1297859327856" mode="PARENT_LAST"/>
By doing a deployment in to WebSphere Application Server, lets see what happens to the application’s config post deployment.
Configuration of Server before application deployment, to what we want but wanted to compare if this sis changed in anyway.
Here is the application specific class loader as a result of deployment. You can see that the class loader order for the application is set to "Classes loaded with local class loader first (parent last)" and the web modules class loader (WAR class loader policy) is set to "Single class loader for application"
Server class loader us unchanged, post application deployment
Let’s try with an EAR that doesn’t have these settings overridden
What I did is basic empty EAR with a an Empty WAR which is deployed with no extended configuration so it is clean from IBM specific deployment information.
You can see in the image below, that the class loader order for the application is set to "Classes loaded with parent class loader first (parent first)" and the web modules class loader (WAR class loader policy) is set to "Class loader for each WAR in application"
What we can do is probably just add the deployment.xml into the correct folder within the EAR ie
ClassLoaderTestEAR\META-INF\ibmconfig\cells\defaultCell\applications\defaultApp\deployments\defaultApp\deployent.xml and voila we can control the class loader settings during deployment.
Steve Robinson has been working in IT for over 20 years and has
provided solutions for many large-enterprise corporate companies across
the world. Steve specialises in Java and Middleware.
In January 2013, I was awarded the prestigous
'IBM Champion' accolade.
IBM WebSphere Application Server 8.0 Administration Guide
WebSphere Application Server 7.0 Administration Guide
Contact | Articles | Shell Scripts | Java Code | JACL | Jython | WebSphere MQ | WebSphere Message Broker | WebSphere Blog | © Copyright 2006-2013 Robinson (UK) Limited