?
Solved

Creating an MBeanServer?

Posted on 2010-11-24
6
Medium Priority
?
322 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 1000 total points
ID: 34203321
> final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();

this should create a server
0
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Assisted Solution

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

Assisted Solution

by:ksivananth
ksivananth earned 1000 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 August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
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 theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

752 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