• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4262
  • Last Modified:

Placing properties files on EAR, instead of WAR file

I have some config properties, e.g. log4j.properties (and other app config files) and I would like to place the on the EAR level, instead of WAR level? Any ideas how to do so on Websphere 6?

On WAR level, I can simply then under WEB-INF/classes.

I tried to put those properties files on the EAR root level and then add the Class-Path: log4j.properties xxxx

But, seems the WAR application (war and log4j.jar) can't read those properties..
0
mscprojhk
Asked:
mscprojhk
1 Solution
 
valipotorCommented:
From:
http://www.ibm.com/developerworks/websphere/library/techarticles/0112_deboer/deboer.html

Yes, property files can be made part of the EAR file. This is equivalent to putting utility classes or a utility JAR file in the EAR file. Here are the basic steps:

   1. Add the property files to the EAR file as a JAR file or within a directory.
   2. Update the manifest file of the module that needs access to the property file to contain the run-time relative path to the folder or JAR(WAR) file within the EAR file. Doing this will add the property file to the classpath of that module.
   3. Use Class.getResourceAsStream() from the module to load the properties file from its classpath.

Hope this helps you,

valipotor
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now