Hi,
As a WebLogic Administrator Many times we want to make some changes in the application provided by the Development team. But it is not good for a WebLogic Administrator to make changes in the application archieve provided by the Application Development team. But to fulfill some environmental requirements the Administartor has to make some changes in the application.
WebLogic provides a best way for the WebLogic Administrators to alter the different Tags present inside the Application deployment descriptors like adding a new Tag or replacing a value of a Tag mentioned in the “web.xml” or in “weblogic.xml” or in any of the deployment descriptor like “weblogic-ejb-jar.xml”,”application.xml”, “weblogic-application.xml”…etc.
Here we are going to see a very simple demonstration on adding a WelCome Page to our Application.
Why We need Welcome Page?
Suppose Users access my application’s welcome page like following : “http://someHost:7001/MTestApp/login.htm”
But i don’t want to display the “login.htm” in the URL rather i want as soon as the user enters the following URL: “http://someHost:7001/MTestApp” the “login.htm” Page content should automatically appear in the webPage.
For example if we have the following kind of “web.xml” file inside our application :
<?xml version="1.0? encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <!-- We don't have any welcome page defined here --> </web-app>
And if we want to add the <welcome-file-list> Tag set in the above “web.xml” file without physically editing the WAR file or the “web.xml” file as below, then we can do it using “plan.xml” file
<?xml version="1.0? encoding="UTF-8"?> <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <welcome-file-list> <welcome-file>login.htm</welcome-file> </welcome-file-list> </web-app>
Step1). We assume that already your application is deployed on the WebLogic Server.
Step2). Suppose your WAR name is “TestWelcomePage” (i am considering it as an exploded WAR…you can use it with Archieved WAR file as well).
Step3). Anywhere in your file system Just paste the following “plan.xml” file: (Suppose Location is “F:WelcomePage_PlanDemo” )
<?xml version='1.0' encoding='UTF-8'?> <deployment-plan xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-deployment-plan.xsd" global-variables="false"> <application-name>TestWelcomePage</application-name> <!-- You need to change this Line and Put your Web Application Name --> <variable-definition> <variable> <name>welcomeFileName</name> <value>login.htm</value> </variable> </variable-definition> <module-override> <module-name>TestWelcomePage</module-name> <!-- You need to change this Line and Put your Web Application Name --> <module-type>war</module-type> <module-descriptor external="true"> <root-element>web-app</root-element> <uri>WEB-INF/web.xml</uri> <variable-assignment> <name>welcomeFileName</name> <xpath>/web-app/welcome-file-list/welcome-file</xpath> </variable-assignment> </module-descriptor> </module-override> <config-root>F:WelcomePage_PlanDemo</config-root> <!-- You need to change this Line and Put the location of plan.xml file wherever u have pasted it --> </deployment-plan>
Step4). Login to AdminConsole and goto deployments page—-> the select your Application (After Pressing Lock & Edit Button) –> update (click this button)—> browse your “plan.xml” file location and then finish.
Once the changes will be activated ….Next time your will see that your Welcome page is changed.
Note: you won’t see any changes in the Actual WAR file (inside the application), this entry in plan.xml will be used by weblogic apart from the Actual application archieve. This is the biggest advantage of using plan.xml feature of weblogic.
.
.
Thanks
Jay SenSharma
April 28th, 2011 on 11:32 am
if there is an existing session on this application or any sample application that we want to update using plan.xml, will that session be lost during the update process or that session will be still on.
May 2nd, 2011 on 6:59 pm
Hi Testab,
Plan.xml can be used with two scenarios …with redeployment and with Update of an Application. So in case of an Update of an application using Plan.xml will not cause any kind of Session Loss… But if you will use redeployment of application using Plan.xml then it will loose HttpSessions.
To keep Http Sessions remain as it is you can use the Production redeployment feature of WebLogic. http://middlewaremagic.com/weblogic/?p=394
.
.
Keep Posting 🙂
Thanks
Jay SenSharma
January 19th, 2012 on 5:20 pm
Hi Jay,
Can we override the values in JMS-Module.XML using the deployment plan ?
Below is the JMSModule.xml which is bundled inside the EAR which we use and here we have to change the connection-url and JNDI properties based on the environment which we deploy,
sourcecode language=”java” wraplines=”false”
true
SampleJNDI
Sample.entry
SampleConnectionFactory
Sample.connection.factory
com.sonicsw.jndi.mfcontext.MFContextFactory
tcp://12.34.56.643:2645
{AES}W0/xwQ2qabKD51JRGpaPytn985eVNNOiKq5Tneoxje8=
com.sonicsw.jndi.mfcontext.domain
sampleDomain
java.naming.security.principal
Administrator
/sourcecode
Thanks in Advance,
Bharat K