There is a section in the WebSphere Admin console called WebSphere variables (located under Environment), where you can … manage WebSphere variables (WAS variables). But how can one use these WAS variables within a JavaEE application? There is a proprietary way to load them which I will not mention here.
A better way in my opinion is to bridge the WAS variable to an environment variable. Then it can simply be accessed through System.getProperty(“varName”); It’s also easy to access the variable on Tomcat without touching the code.
To bridge a WAS variable:
- Log on to your WAS console.
- Add a WAS variable “myapp.myVar” under Environment -> WebSphere variables
- Go to (something llike) Servers -> Server Types -> Websphere application servers -> YOUR_SERVER -> Java and process management -> Process definition -> Java virtual machine -> Custmo properties
- Define a new variable myapp.myVar = ${myapp.myVar}
- Save and restart.
The value of myapp.myVar can now be obtained: System.getProperty(“myapp.myVar”)
Note :
If you have cluster environment then this configuration should be in all server of cluster.