There are certain cases where you need to use a properties file (ResourceBundle) that can be used in one or more WebSphere Enterprise Applications. One example would be to allow the Application Manager to manage and control properties such as database passwords or other sensitive information that should not come bundled inside various ear/war/jar files.

For instance say a web application uses a “webapp” ResourceBundle (webapp.properties file) in order to obtain the database username and password.

db.user = user
db.password = secretpassword

These properties are retrieved by the web application(s) as follows:

import java.util.ResourceBundle;
. . .
ResourceBundle rb = ResourceBundle.getBundle("webapp");
String dbUser = rb.getString("db.user");
String dbPassword = rb.getString("db.password");

However we don’t want to bundle webapp.properties within the war files; instead we want it to reside outside any war application.

The easiest way to achieve this is to place the properties file directly in the correct directory structure of WebSphere. These directories also depend on the WebSphere and OS version used.

To give an example, a couple of possible locations for the WebSphere 7 runtime that comes bundled with Rational Application Developer:

C:\Program Files (x86)\IBM\SDP\runtimes\base_v7\properties
C:\Program Files (x86)\IBM\SDP\runtimes\base_v7\profiles\was70profile2\properties

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.