Hi, I am writing an open source tool to watch and define alerts on MBeans and
their attributes. For this, I need to be able to see all MBeans. I used to
method below, and I am getting most of the MBeans, but not all. Especially the
ones I registered using
ObjectName name = new ObjectName("MyApp:type=MyStats");
mbeanServer.registerMBean(stats, name);
.. are nowhere to be seen.
Any ideas? Thanks in advance.
-------------
private InitialContext getContext(String serverUrl)
{
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, serverUrl);
InitialContext ic = new InitialContext(props);
return ic;
}
public void connect(Machine machine) {
try {
this.machine = machine;
InitialContext ic = getContext(machine.getId().getIp());
server = (RMIAdaptor) ic.lookup("jmx/rmi/RMIAdaptor");
} catch (Exception e) {
throw new RuntimeException ("exception");
}
}
public Map retrieveAllObjectNames() throws Exception {
for (Object o : server.queryNames(new ObjectName("*:*"), null)) {
String nameString = o.toString();
ObjectName name = new ObjectName(nameString);
try {
MBeanInfo info = server.getMBeanInfo(name);
Map values = new HashMap();
for(MBeanAttributeInfo currInfo : info.getAttributes())
{
...
}
...
}
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3869667#3869667
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3869667
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user