Property File outside WAR for Weblogic

Situation:

Deploy a WAR to Weblogic and the property files need to be outside the WAR.

Solution:

Method 1. Add the path of the property files in the [app domain]/bin/setDomainEnv.sh or startWebLogic.sh.

CLASSPATH=”${CLASSPATH}${CLASSPATHSEP}/deployment/config”

Method 2. Put the property files under [app domain]

Method 3. Use a deployment plan to override the property files.

Step1: create a deployment plan directory structure, such as

deployment/app/  ← xxx.war

deployment/plan/ ← plan.xml (will be generated after deploy the war file from Weblogic Console)

deployment/plan/AppFileOverrides/ ← xxx.properties

Step2: Connect to Weblogic Console → Deployments → Install → Select  path: deployment/app/xxx.war → Next… → Finish

The property files will replace those under /WEB-INF/classes.

(This works for the Managed Server that you do not know where it is located)

Reference: Generic File Loading Overrides

Advertisements

2 thoughts on “Property File outside WAR for Weblogic

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s