JMX MBean Tutorial

JMX MBean Tutorial

JMX (Java Management Extension) is a pure java technology to manage system objects, service oriented network, monitor and manage application where these resource are represented by MBean (Managed Bean) dynamically managed at run time. This got introduced JAVA 5 release.

To manage resources you will have to create MBean first and register it with MBean server. To manage running MBean on server JMX needs to connect MBean server. Java comes with connector called JConsole and its location is JDK_HOME/bin director. Below is example:

  • First create interface (Please be careful when creating MBean where you interface name should be ended with MBean)

  • Implementation class name should be JMX (Please note: According to JXM specificaiton name should be Interface name without MBean keyword)

  • Main class to start MBean and test it:

  • To run this you will have to pass below VM parameter:

  • In eclipse pass as below:

JMX MBean Tutorial

  • To run: Right click Run As –> Java Application. As you see the parameter above we have started JMX at port number 1649. To connect remotely to this server we need to give system ip address and port number. Now to connect it through JConsole. Go to %JAVA_HOME%\bin and double click jconsole.exe:

JMX MBean Tutorial

  • You will see JConsole will find find running agent and its pid. Select that pid then click connect:


  • If you see below warning click insecure:

JMX MBean Tutorial

  • JConsole will open as below. Go to MBean tab there you will see our registered MBean:

JMX MBean Tutorial

  • For more details visit MBean oracle documentation here

Leave a Reply

Your email address will not be published. Required fields are marked *

I am not Robot *