Sunday, May 4, 2014

JMX Getting Started: Standard MBean


Simple Note

Introduction

From official site:
The JMX technology provides the tools for building distributed, Web-based, modular and dynamic solutions for managing and monitoring devices, applications, and service-driven networks. By design, this standard is suitable for adapting legacy systems, implementing new management and monitoring solutions, and plugging into those of the future. 

This article describe how to write JMX Standard MBeans.

Result

View demo on line
http://screencast.com/t/R80hAMjZcggm

Program

Test.java
The testing class to run.

TestBean.java
Test java bean, contains some operations and attribute.

TestBeanMBean.java
The interface for TestBean, according to JMX Standard MBean convention the name should be TestBeanMBean.

How to Run (Windows7/JDK6)

1. Download the bin/test  folder to some where.

2. Open cmd, go to the folder that contains the downloaded test folder.

3. Run it with "java -cp . test.Test".

4. Open jconsole.exe at your jdk/bin folder and try it.

Note:
1. If you didn't setup PATH properly (i.e. cannot execute java command any where) you can copy test folder to path_to_your_jdk_folder/bin.

2. You may need to change TMP folder to different location, please refer to the related thread on oracle community.

Reference

Standard MBean
http://docs.oracle.com/javase/tutorial/jmx/mbeans/standard.html

TMP Issue
https://community.oracle.com/thread/1176284?start=0&tstart=0

Download

Full project at github
https://github.com/benbai123/JSP_Servlet_Practice/tree/master/Practice/JAVA/JMX/MBeans/StandardMBean

No comments:

Post a Comment