jQuery in Action, 3rd edition
The moose likes Websphere and the fly likes Websphere variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Websphere variables" Watch "Websphere variables" New topic

Websphere variables

Jason Eilert

Joined: May 22, 2006
Posts: 5
I was wondering if there is a way to keep String variables on a websphere application server to allow me to change the variable in the admin
console so that the String is different based on the server the application is running on.

For example, I'm having an issue on different server environments where I need to point to a different location based on the environment.

Any help would be appreciated.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19758

Of course, that's exactly the sort of thing they are for.

But you seem to be asking about Websphere variables as if you weren't sure whether they actually existed. Look under the "Environment" tab in the admin console and you'll see a "Websphere variables" link. Was that what you were asking?
Jason Eilert

Joined: May 22, 2006
Posts: 5
I know they (websphere variables) exist, but didn't know they could be used for these kind of cases. I just figured they were there for the applicaiton.

I'll just create a new one and access it in a servlet. Thanks for your quick response, I'll give it a try.
Jason Eilert

Joined: May 22, 2006
Posts: 5
I was able to create a websphere variable and access it. The following code did the trick....

I was wondering if this is the correct way to go about retrieving a websphere variable.
Steve Clarke

Joined: Feb 16, 2011
Posts: 1

I've tried this code but am having a problem with this line:

Set objs = adminService.queryNames( queryName, null );

it is returning a null pointer exception.

Can I confirm with you which class libraries you imported to ensure types, as Set has two different class libraries.

Here are the ones I imported:

import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;

import com.ibm.websphere.*;
import com.ibm.websphere.management.AdminService;
import com.ibm.websphere.management.AdminServiceFactory;

Suggestions welcomed.


jQuery in Action, 3rd edition
subject: Websphere variables
It's not a secret anymore!