Placing properties files on EAR, instead of WAR file

Posted on 2007-08-02
Last Modified: 2010-05-18
I have some config properties, e.g. (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: xxxx

But, seems the WAR application (war and log4j.jar) can't read those properties..
Question by:mscprojhk
    LVL 6

    Accepted Solution


    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,

    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    installing and using WTP plugin eclipse MARS 3 67
    fizzArray2 challenge 1 44
    sumHeights2  challenge 7 52
    stringclean challenge 26 43
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    The viewer will learn how to implement Singleton Design Pattern in Java.
    This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now