Weblogic deployment plan example for context root change

Oracle Weblogic Server

if you want to change the context root of your application specified in weblogic.xml through a deployment plan then please follow below steps:

Create a file like below plan.xml(Copy Paste into a notepad and save it as “plan.xml”)

<?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>MyApp</application-name>
<variable-definition>
<variable>
<name>myNewRoot</name>
<value>newContextRoot</value>
</variable>
</variable-definition>
<module-override>
<module-name>MyApp</module-name>
<module-type>war</module-type>
<module-descriptor external="false">
<root-element>weblogic-web-app</root-element>
<uri>WEB-INF/weblogic.xml</uri>
<variable-assignment>
<name>myNewRoot</name>
<xpath>/weblogic-web-app/context-root</xpath>
<operation>replace</operation>
</variable-assignment>
</module-descriptor>
</module-override>
<config-root>C:\WLS\WLS1030\user_projects\domains\MyApp</config-root>
</deployment-plan>

Here:
application-name – Your application name : MyApp
Name             – Your new root name
Value            – Your new context root
config-root      – Your WLS Configuration file path

Context Root is a Non-dynamic property and which you are modifying to update Bean: weblogic.j2ee.descriptor.wl.WeblogicWebAppBeanImpl ContextRoots

1. Stop your application.
2. Extract/unzip/unjar/explode your application war file(MyApp.war) and put it in same location(Here MyApp.war folder after extraction)
3. Update your application with new plan.xml with the modified context-root
4. Start the application, now the application is ready to accept with new context-root.
5. check the testing tab which shows updated context-root

Note: Oracle does not support using a deployment plan to change the context-root in an application.xml file. However, if an application is deployed as a library, you can either change the context-root through an weblogic-application.xml file or use the deployment plan to change the context-root in an weblogic-application.xml file.

For more info on deployment plan follow below link:

http://docs.oracle.com/cd/E12840_01/wls/docs103/deployment/config.html#plans

In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.