Hi,

Jay SenSharma

Jay SenSharma

Suppose if you already have deployed your WebApplication (WAR) file on the Server …this time if you hit your Application then in AdminConsole you will see that the requests are being processed by the “default” workManager.

To see this you can login to your applications workmanager status ….
AdminConsole—>Deployments—.YourWebApplication—>Monitoring (TAB)—>workload (Sub tab)
.
Here you will see that as soon as you hit your webapplication it’s request is being served by the “default” work manager. You don’t want to Change your WebApplication by adding <wl-dispatch-policy> tag inside your “weblogic.xml”. So this can be done by using “Plan.xml”…using this file we will assign WorkManager Dynamically to an existing application without physically touching the actual application.
.
NOTE: Please make sure that atleast on “weblogic.xml” is already available inside your WebApplication which uses WLS9.x onwards schema defination…like following… If you already have weblogic.xml inside your WAR then it’s good…or else please add the following empty “weblogic.xml” inside your WebApp…
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<weblogic-web-app xmlns=”http://www.bea.com/ns/weblogic/90″>
</weblogic-web-app>

.
Step1). Create a WorkManager through AdminConsole with the following configuration:
with the following Configuration: in your “config.xml”…or define your Workmanager according to your requirement
<self-tuning>
<context-request-class>
<name>ContextReqClass-0</name>
<target>AdminServer</target>
</context-request-class>
<min-threads-constraint>
<name>MyMaxConstraint</name>
<target>AdminServer</target>
<count>1</count>
</min-threads-constraint>
<capacity>
<name>CapacityConstraint-0</name>
<target>AdminServer</target>
<count>1</count>
</capacity>
<work-manager>
<name>myConsoleWorkManager</name>
<target>AdminServer</target>
<context-request-class>ContextReqClass-0</context-request-class>
<min-threads-constraint>MyMaxConstraint</min-threads-constraint>
<capacity>CapacityConstraint-0</capacity>
</work-manager>
</self-tuning>
Note: After configuring the above workManager we need to restart the Server…As a Best practice.
.
.
Step2). Open a Command window or a Shell prompt and then run “. ./setWLSEnv.sh” or “setDomainEnv.sh” to set the environment in that shell.
.
.
Step3). In the Shell prompt Move till the your WAR file…Lets say your WAR filename is “MyWorkManagerDemo.war”. which is placed inside
“/opt/apps” directory then first do
cd /opt/apps
.
.
Step4). Now run the “weblogic.PlanGenerator” utility to generate the Plan.xml file in the current Directory. Like following:
java weblogic.PlanGenerator -all MyWorkManagerDemo.war
OUTPUT:
Generating plan for application MyWorkManagerDemo.war
Export option is: all
Exporting properties…
Saving plan to /opt/apps/plan.xml…
<Mar 14, 2010 2:57:00 PM IST> <Info> <J2EE Deployment SPI> <BEA-260072> <Saved configuration for application, MyWorkManagerDemo>
.
.
Step5). Now the generated “plan.xml” file will be bit large …we need to edit it…
.
.
Step6). Edit it like:
You will find <variable-definition> with many sub tags like <variable>   Just edit one of them and delete rest of the <variable> Tags
you can give any name to the variable like “firstVariableName”.
Now edit the next line <value xsi:nil=”true”></value>  by removing the  xsi:nil=”true” from this Tag….means you need to change it to and then add your WorkManager name there like:
<value>myConsoleWorkManager</value>
Now edit the Module which you want to override: <module-override> and then assign the Variable there and <config-root> tag pointing to the Plan.xml directory…Finally you will get a “plan.xml” file like following:
<?xml version='1.0' encoding='UTF-8'?>
<deployment-plan xmlns="http://www.bea.com/ns/weblogic/deployment-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/deployment-plan http://www.bea.com/ns/weblogic/deployment-plan/1.0/deployment-plan.xsd" global-variables="false">
<application-name>MyWorkManagerDemo.war</application-name>
<variable-definition>
<variable>
<name>firstVariableName</name>
<value>myConsoleWorkManager</value>
</variable>
</variable-definition>
<module-override>
<module-name>MyWorkManagerDemo</module-name>
<module-type>war</module-type>
<module-descriptor external="true">
<root-element>weblogic-web-app</root-element>
<uri>WEB-INF/weblogic.xml</uri>
<variable-assignment>
<name>firstVariableName</name>
<xpath>/weblogic-web-app/wl-dispatch-policy</xpath>
</variable-assignment>
</module-descriptor>
</module-override>
<config-root>/opt/apps/</config-root>
</deployment-plan>
.
.
Step7). Now Login to AdminConsole then Update your Application …while updating your Application it will ask for the “plan.xml” file Location…just browse for this file… While updating your WebApplication with “plan.xml” file please choose the following radio button in the AdminConsole:
“Redeploy this application using the following deployment files” FINISH
.
.
Step8). Now hit your application …you will see in the “workload” Subtab of your application then it is being processed by the “myConsoleWorkManager” which is created by us.
.
.
.
Thanks
Jay SenSharma
If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.