Solved

Creating an MBeanServer?

Posted on 2010-11-24
6
317 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

729 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