File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to get MBeanServer from Servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to get MBeanServer from Servlet?" Watch "How to get MBeanServer from Servlet?" New topic
Author

How to get MBeanServer from Servlet?

Yashnoo lyo
Ranch Hand

Joined: Feb 17, 2003
Posts: 152
Hi everyone:

Did someone use the JMX in web server? I registe a MBean in servlet while Tomcat startup.And I want to get this MBean in my one servlet. But I don't know how to get the MBeanserver that I need. My code is:

Registe MBean --->



Get MBean --->


But the problem is that there are many MBean registed while tomcat startup. I don't know which is that I need. I see the javadoc ,it says:


the findMBeanServer can find my MBean.But what is agentId (the param)? Someone used this before?
I have two class in this example:

SystemVar.java


SystemVarMBean.java

I mean that how to get my registed MBean?
Please help! Thks!! :roll:


When I face C# and Java I choose Java.
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
MBeans are referenced by the name used when bound. I suggest you check out the JMX tutorial on java.sun.com.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Yashnoo lyo
Ranch Hand

Joined: Feb 17, 2003
Posts: 152
Originally posted by Nathaniel Stoddard:
MBeans are referenced by the name used when bound. I suggest you check out the JMX tutorial on java.sun.com.


Thanks for your reply. But I don't find any about reference a MBean. I mean that this code:


I don't know how to get my MBeanServer in this code. What is the AgentID(the param)?
Help :roll:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get MBeanServer from Servlet?
 
Similar Threads
JMX registration
JMX: registerMBean
Should I bean this?
develpoing simple mbean
How to reference a JMX MBean ?