Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Websphere variables

 
Jason Eilert
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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.

Thanks

Steve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic