Solved

Creating an MBeanServer?

Posted on 2010-11-24
6
291 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
network + 7 80
java  and programming certification ? 4 86
ArrayIndexOutOfBoundException 9 66
thymeleaf natural templating vs JSP 2 66
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now