Websphere cell variables

It happened to me the needing of retrieving via java, in a Websphere 5.1 server, a string variable defined at a “cell level”.

After some research, I found that the variable have to be defined in the following path (Websphere admin console): admin console -> environment -> naming -> name space bindings and then it can be retrieved by the following java code

String s = (new InitialContext()).lookup("thisNode/cell/legacyRoot/variablename");

What I thought the first time: define the variable in admin console -> environment -> manage websphere variables, is not working because the variables here defined, are only for administrative purpose and can’t be seen by the jvm.

Another way to make a variable available for all the applications is to define it directly on the jvm command line and then retrieve it by the System.getProperty(). But if you have more than one server, it’s too expensive to maintain, because you will have to define it for each server.


3 thoughts on “Websphere cell variables

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s