|
Home > Archive > WebSphere Application Server > February 2007 > JMX in cluster on WS 5.1
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
JMX in cluster on WS 5.1
|
|
|
| Hello all,
We have a simple WebApplication (deployed inside EAR on the WebSphere 5.1) that registers the MBean using AdminService.registerMBean(object, objectName); where ObjectNames are filled with correct cell;node;process attributes accordin to the WS JMX require
ments (thank you, Mr. Williamson, the only available source of the WS 5.1 JMX information).
In the cluster I can see registered MBeans via "wsadmin.sh", I can see that on each node one MBean instance is registered.
However I need to manage MBeans from the application running inside WebSphere on the cluster, therefore I'm trying to find MBeans via JMX API:
ObjectName on = new ObjectName("Domain:*,name=MyMBean");
Set set = mBeanServer.queryNames(on, null);
And in my application (running inside WS) I always get only one ObjectName in the resulting set, which is very strange because running the same query in the "wsadmin.sh" returns multiple instances.
Could you please help me and point out what I'm doing wrong?
Thank you very much,
Renat Zubairov
| |
| Ken Hygh 2007-02-19, 7:22 am |
| renat.zubairov@gmail.com wrote:
> Hello all,
>
> We have a simple WebApplication (deployed inside EAR on the WebSphere 5.1) that registers the MBean using AdminService.registerMBean(object, objectName); where ObjectNames are filled with correct cell;node;process attributes accordin to the WS JMX requi
rements (thank you, Mr. Williamson, the only available source of the WS 5.1 JMX information).
> In the cluster I can see registered MBeans via "wsadmin.sh", I can see that on each node one MBean instance is registered.
> However I need to manage MBeans from the application running inside WebSphere on the cluster, therefore I'm trying to find MBeans via JMX API:
>
> ObjectName on = new ObjectName("Domain:*,name=MyMBean");
> Set set = mBeanServer.queryNames(on, null);
>
> And in my application (running inside WS) I always get only one ObjectName in the resulting set, which is very strange because running the same query in the "wsadmin.sh" returns multiple instances.
>
> Could you please help me and point out what I'm doing wrong?
>
> Thank you very much,
>
> Renat Zubairov
Renat,
I'm not sure how you've initialized 'mBeanServer', but it needs to be
the Deployment Manager, not the local application server.
Ken
| |
|
| >
> Renat,
> I'm not sure how you've initialized 'mBeanServer',
> but it needs to be
> the Deployment Manager, not the local application
> server.
>
> Ken
Hello Ken,
Thank you very much for the response, it might be _the problem_ I'm fighting with.
I'm currently just get the MBeanServer from the
AdminService.getMBeanFactory().getMBeanServer();
What should be another way to get the MBeanServer?
Is it possible to do it from within appllication server without supplying administrator username/password?
Renat
| |
| Ken Hygh 2007-02-19, 1:18 pm |
| renat.zubairov@gmail.com wrote:
>
> Hello Ken,
>
> Thank you very much for the response, it might be _the problem_ I'm fighting with.
> I'm currently just get the MBeanServer from the
>
> AdminService.getMBeanFactory().getMBeanServer();
>
> What should be another way to get the MBeanServer?
> Is it possible to do it from within appllication server without supplying administrator username/password?
>
> Renat
Renat,
Check out the InfoCenter for 'AdminClient', which is the remote
interface used to get to MBeanServer objects in other processes.
If you have security enabled, then you'll need the administrator userid
& password. FWIW, I use the following code myself. Hopefully you're not
using the default keystores so you'll need to make some modifications here.
Ken
public AdminClient getSecureAdminClient(String host, String port,
String user, String password) throws ConnectorException {
AdminClient ac = null;
Properties props = System.getProperties();
props.setProperty(AdminClient.CONNECTOR_TYPE,
AdminClient.CONNECTOR_TYPE_SOAP);
props.setProperty(AdminClient.CONNECTOR_HOST, host);
props.setProperty(AdminClient.CONNECTOR_PORT, port);
props.setProperty(AdminClient.PASSWORD, password);
props.setProperty(AdminClient.USERNAME, user);
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
props.setProperty("javax.net.ssl.trustStore","/opt/WebSphere/ND6/profiles/default/etc/DummyClientTrustFile.jks");
props.setProperty("javax.net.ssl.keyStore","/opt/WebSphere/ND6/profiles/default/etc/DummyClientKeyFile.jks");
props.setProperty("javax.net.ssl.trustStorePassword","WebAS");
props.setProperty("javax.net.ssl.keyStorePassword","WebAS");
try {
ac = AdminClientFactory.createAdminClient(props);
} catch (ConnectorException e) {
//new AdminException(ex).printStackTrace();
System.err.println(getClass().getName() + ".getAdminClient()
Exception: " + e);
throw e;
}
return ac;
}
| |
|
| > renat.zubairov@gmail.com wrote:
>
> Renat,
> Check out the InfoCenter for 'AdminClient', which is
> the remote
> interface used to get to MBeanServer objects in other
> processes.
>
> If you have security enabled, then you'll need the
> administrator userid
> & password. FWIW, I use the following code myself.
> Hopefully you're not
> using the default keystores so you'll need to make
> some modifications here.
>
> Ken
>
> public AdminClient getSecureAdminClient(String host,
> , String port,
> String user, String password) throws
> ConnectorException {
> AdminClient ac = null;
> Properties props = System.getProperties();
> props.setProperty(AdminClient.CONNECTOR_TYPE,
> AdminClient.CONNECTOR_TYPE_SOAP);
> props.setProperty(AdminClient.CONNECTOR_HOST,
> T, host);
> props.setProperty(AdminClient.CONNECTOR_PORT,
> T, port);
>
> props.setProperty(AdminClient.PASSWORD, password);
> props.setProperty(AdminClient.USERNAME, user);
> props.setProperty(AdminClient.CONNECTOR_SECURITY_ENA
> BLED, "true");
>
>
> props.setProperty("javax.net.ssl.trustStore","/opt/Web
> Sphere/ND6/profiles/default/etc/DummyClientTrustFile.j
> ks");
>
> props.setProperty("javax.net.ssl.keyStore","/opt/WebSp
> here/ND6/profiles/default/etc/DummyClientKeyFile.jks")
> ;
> props.setProperty("javax.net.ssl.trustStorePassword"
> ,"WebAS");
> props.setProperty("javax.net.ssl.keyStorePassword","
> WebAS");
> try {
> ac = AdminClientFactory.createAdminClient(props);
> } catch (ConnectorException e) {
> //new AdminException(ex).printStackTrace();
> System.err.println(getClass().getName() +
> ) + ".getAdminClient()
> Exception: " + e);
> throw e;
> }
> return ac;
>
> }
Hello Ken,
Thank you very much for the response, I'll try to do that. I think that's the solution of my problem. Thank you.
Renat
|
|
|
|
|