This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get MBeanServer from Servlet?

 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MBeans are referenced by the name used when bound. I suggest you check out the JMX tutorial on java.sun.com.
 
Yashnoo lyo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic