We have an Axis2 application which we run inside websphere application server. The application is packaged as a WAR file. We need to run two copies of the same WAR within the same copy of websphere, and have each copy of the app load a different properties file from the filesystem. I'm looking for something that I can set from the websphere management console while deploying the application, which is visible to the app and can be used to change how the app searches for its properties.
Right now the properties file is stored in the WAR so we build a different version of the WAR for each environment. Instead, we'd like to use a single, non-environment-specific WAR file with an external properties file stored in the filesystem. We have that working. However, we have two development environments hosted within the same copy of websphere. So we need to deploy two copies of the same WAR within the same websphere server and have each instance load a different properties file.
One thing we tried was to check the context root. When two copies of the app are deployed, they each have to have a different context root (the first part of the URL used to access the app), and the Axis2 ConfigurationContext includes a function for reading the context root. Unfortunately, when the app runs within WAS, it's getting the Axis2 idea of the context root--which is always "axis2"--and not the real context root that WAS is using.
EDIT: To clarify, we want to load the properties file during application startup (during ServiceLifecycle.startup() for those of you familiar with Axis2). At that point there's no actual web service request to be processed, so we don't have a message context to examine.
WebSphere resource references such as a URL resource can be obtained by lookup from java:comp/env namespace, hence being bound at deployment time. So you can deploy twice and bind to different instances - you are probably familiar with doing that for JDBC resources.
There are various flavours of useful resource you can use such as a FILE URL. See The info centre