Solved

Creating an MBeanServer?

Posted on 2010-11-24
6
314 Views
Last Modified: 2012-05-10
I have a standard application and I want to expose an MBean. Currently I am doing the following in my application init:


final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                  ObjectName name;

                  name = new ObjectName("com.example:type=myMBean");

                  final myMBean mbean = new myMBean();
                  mbs.registerMBean(mbean, name);

This was taken from the link, and I assume if I've done it right I can directly access the MBean via JConsole.

I was also looking at the Spring Implementation, but am unsure if I am required to start a server first:

http://static.springsource.org/spring/docs/2.5.x/reference/jmx.html


Essentially all I want to do is have my standalone application make the MBean availble so that JConsole can be used to extract the required information.

Cheers
0
Comment
Question by:directxBOB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 34203321
> final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

this should create a server
0
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 250 total points
ID: 34203374
make sure you pass the necessary command line args,

-Dcom.sun.management.jmxremote.port=60000
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
0
 

Author Comment

by:directxBOB
ID: 34257767
Having problems with this at the moment, still trying to debug through exactly what is going wrong.


final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
                  ObjectName name;

                  name = new ObjectName("com.example:type=myMBean");

                  final myMBean mbean = new myMBean();
                  mbs.registerMBean(mbean, name);




Should myMbean be the actual Interface or Implementation class?


The exception I am getting out is:

Additional Info      MBean, Non Compliant MBean : MBean class myMBean does not implement DynamicMBean, neither follows the Standard MBean conventions (javax.management.NotCompliantMBeanException: Class myMBean is not a JMX compliant Standard MBean) nor the MXBean conventions (javax.management.NotCompliantMBeanException: myMBean: Class myMBean is not a JMX compliant MXBean)


Any ideas?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 34262415
sounds like theres a problem with your myMBean class
0
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 250 total points
ID: 34264852
you should register it as a type of StandardMBean!
0
 

Author Closing Comment

by:directxBOB
ID: 34588489
Sorry about delay with this, been swamped with work, and not got around to wrapping up the MBean
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question