Accessing an MBean Programmatically

Hi can anybody tell me how access an mbean by a sample program .

For example in case of jboss , the jboss-service.xml contains an entry like the following...

*****************

<mbean code="org.jboss.jmx.adaptor.rmi.RMIAdaptorService"

name="jboss.jmx:type=Connector,name=RMI">

<!-- Bind the RMIAdaptor to JNDI name jmx/rmi/RMIAdaptor -->

<attribute name="JndiName">jmx/rmi/RMIAdaptor</attribute>

<!-- Use an anonymous listening port -->

<attribute name="RMIObjectPort">0</attribute>

<!-- Bind on every available interface -->

<attribute name="ServerAddress"></attribute>

</mbean>

*****************

From this I use the part ....

'<attribute name="JndiName">jmx/rmi/RMIAdaptor</attribute>'

i.e. my JNDI Name is jmx/rmi/RMIAdaptor

So in my code it is like ..

MBeanServerConnection server = (MBeanServerConnection) ctx.lookup("jmx/rmi/RMIAdaptor");

Now in case of JCAPS from where I can get the JNDI lookup string name ? If some one has any sample code or doc it will be very helpful for me .

Regards,

Ayan

[1211 byte] By [Ayan_Kolkata] at [2007-11-26 11:54:40]
# 1
Hi,Any clue from any body ? what I want is just the lookup String of MBeanServer inside JCAPS so that I can get that by doing context.lookup(MBEAN_SERVER_JNDI_NAME) ? Some one of us might have done that before I hope ,any help will be great for me .Regards,Ayan
Ayan_Kolkata at 2007-7-7 12:12:36 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 2

Hello Ayan,

The Java CAPS Integration Server uses the JMX Agent that is part of java 1.5.

Look at http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html.

It describes how to turn on the MBean Server (JMX Agent) and how to access it programmatically.

Hope that helps.

Luis

ldeavila at 2007-7-7 12:12:36 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 3
Out of interest the CAPS IS ships with jmx-console ... this allows you to browse around ... http://localhost:18000/jmx-console/
WJW@UK at 2007-7-7 12:12:36 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...