Jay SenSharma

Jay SenSharma

Many times we all come across an issue where according to different environments in the production/QA/Testing/LAB we need to change the Properties files which is being used by the Application. And Properties file is placed inside the Application archive. We dont want to extract the archive EAR/WAR file to replace the Properties files to deployed in defferent environments. Sometimes in production Envs we want to make a small change in the properties file without any physical modification in the Actual Archieve…on the fly.

This Feature is also called as “Generic File Overloading using (AppFileOverrides) directory”.

WebLogic provides us this feature from WLS10.1 onwards to update an application’s static resources like Properties files/xml’s etc. Like following:


Step1).Directory Structure is very in order to achieve this…so better follow the exactly same directory structure…relatively to ur File Systems…

Create a Directory somewhere in your file system like following :

Step2). Create an EAR Application Directory “MyEAR” like following:


Step3). Create the “META-INF” Directory for your EAR Application in following location:


Step4). Place the following “application.xml” file inside: “C:ResourceLoadingDemoMyEARMETA-INF”

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4">
<description>Split Directory Example</description>
<display-name>resource Loading Example</display-name>

Step5). Create “ResourceWeb” WAR application inside the MyEAR Application. Like following

NOTE: Once the ResourceWEB will be ready we will convert it into WAR file like: “ResourceWEB.war”

Step6). Provide the “index.jsp” file to read the Properties file in the following location: “C:ResourceLoadingDemoMyEARResourceWeb”

<%@ page import="java.util.*"%>
<h2> reading Property Files :
Properties myAppProps = new Properties();
System.out.println("nnt ContextClassLoader : "+Thread.currentThread().getContextClassLoader());
InputStream iostream =Thread.currentThread().getContextClassLoader().getResourceAsStream("MyProps.properties");
System.out.println("nnt Got InputStream : "+iostream);

out.println("<h2>keyOne : "+myAppProps.getProperty("keyOne"));
out.println("<h2>keyTwo : "+myAppProps.getProperty("keyTwo"));
out.println("<h2>keyThree : "+myAppProps.getProperty("keyThree"));

Step7). Create a Properties  “MyProps.properties” in the following Location: “C:ResourceLoadingDemoMyEARResourceWEB-INFclasses”  Like following key-value pairs:


Step8). Provide a default “web.xml” in the following Location : “C:ResourceLoadingDemoMyEARResourceWEB-INF”

<!DOCTYPE web-app PUBLIC  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"  "http://java.sun.com/dtd/web-app_2_3.dtd">

You must provide at least one default “weblogic.xml” file … with some contents inside it or Just a Default …like following:

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">

Step9). Open a command prompt and then run “. ./setWLSEnv.sh” or “setWLSEnv.cmd” and then nevigate to the directory:

“C:ResourceLoadingDemoMyEARResourceWeb” to create a WAR file:

C:ResourceLoadingDemoMyEARResourceWeb>jar cvf ResourceWeb.war .
added manifest
adding: index.jsp(in = 697) (out= 298)(deflated 57%)
adding: WEB-INF/(in = 0) (out= 0)(stogreen 0%)
adding: WEB-INF/classes/(in = 0) (out= 0)(stogreen 0%)
adding: WEB-INF/classes/MyProps.properties(in = 68) (out= 39)(deflated 42%)
adding: WEB-INF/lib/(in = 0) (out= 0)(stogreen 0%)
adding: WEB-INF/web.xml(in = 157) (out= 133)(deflated 15%)

Step10). Cut the “ResourceWeb.war” file from “C:ResourceLoadingDemoMyEARResourceWeb” and Paste it inside : “C:ResourceLoadingDemoMyEAR” Location.

Step11). Delete the “ResourceWeb”  Directory present inside “C:ResourceLoadingDemoMyEAR”.

Step12). Deploy “MyEAR” application present in “C:ResourceLoadingDemo” location on the WebLogic Server.

Step13). Access the “index.jsp” Page to see if we are able to access the Properties file data or not:


Step14). Now in order to overtide the Properties file present inside the ResourceWeb.war file we need to create a Directory “plan” Just beside “MyEAR” inside the following Location “C:ResourceLoadingDemo”

Step15). Create “plan.xml” file like following present in the following location: “C:ResourceLoadingDemoplan”

To create Plan.xml Just Change the Session-Invalidation interval from Admin Console…it will create the following “Plan.xml” or u can use any existing file as well. Location of this file must be “C:ResourceLoadingDemoplan”

<?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">


<module-descriptor external="true">
<module-descriptor external="false">

<module-descriptor external="false">
<module-descriptor external="false">


Step15-A). Create a Directory Tree like following:


Note:  “ResourceWeb.war” in the above path is a Directory and not a File.

Step16). To Override the Property file , Please Provide a new Property file “MyProps.properties” inside “C:ResourceLoadingDemoplanAppFileOverridesResourceWeb.war” directory. With New Values…

keyOne=<font color=green>ValueOfKeyOneCHANGED_A</font>
keyTwo=<font color=green>ValueOfKeyTwoCHANGED_B</font>
keyThree=<font color=green>ValueOfKeyThreeCHANGED_C</font>

Step17). Login to WebLogic Admin Console and then Click Lock&Edit Button —>Select your Application…(MyEAR)—>Update

Step18).Once u Activate the changes from Admin Console…Now refresh the Browser…




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.