Questions tagged [jmx]

Java Management eXtensions is a standard Java API that enables the instrumentation and monitoring of a running Java program.

JMX

Java Management Extensions (JMX) is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (e. g. printers) and service oriented networks. Those resources are represented by objects called MBeans (for Managed Bean). In the API, classes can be dynamically loaded and instantiated. Managing and monitoring applications can be designed and developed using the Java Dynamic Management Kit (JDMK) which is also available and more commonly implemented using the open sourced version OpenDMK.

JMX classes live in the javax.management packages.

JMX is a part of the Java platform since Java SE 5 (though some components are optional and not bundled with the JRE).

References


Glossary

  • MBean: A logical unit, or service, most easily visualized as a Java Bean, that provides a defined service exposed through the JMX protocol. One instance of an MBean typically is identified by an ObjectName (see below). These services commonly include, but are not limited to:
    1. Getters and Setters that allow the reading and writing of the MBean's Attributes. For example, an MBean might represent a thread pool and an attribute named MaxPoolSize could be read to determine what the maximum allowable size of the pool is, while writing the attribute would modify the maximum allowable size of the pool that the MBean is managing.
    2. Operations that execute a specific piece of functionality in an MBean. Operations can be thought of as bean methods that do not fit the attribute (or Java Bean property) model. They may have no return value and have zero, one or more parameters. For example, an operation called stop might stop the thread pool that is managed by an MBean.
    3. MBeans may emit Notifications when a specific condition is met, or the MBean detects a specific event. Notifications can be subscribed to by NotificationListeners that have registered to be notified of these events. For example, an MBean might send notifications when the thread pool it manages is started, and then again when it is stopped.
  • MBeanServer: The MBeanServer plays multiple roles in a JMX environment:
    • It is the central registry for MBeans within a given JMX domain. As the registry, the MBeanServer provides functionality to register, unregister, enumerate and search for MBeans.
    • The MBeanServer provides the invocation interface for accessing registered MBeans. When a thread wants to read or write attributes, execute an operation or [un]register a notification listener in an MBean instance, it does so through the MBeanServer by providing the ObjectName of the target MBean and the parameters of the invocation.
  • ObjectName: This is a composite key that serves to both define the unique identity of one MBean, and as pattern that describes a group of MBeans that have matching sub-keys of their ObjectNames in common. There are 2 parts to an ObjectName:
    1. The Domain Name:
    2. The Key Properties:

A visual of the structure of an ObjectName

2442 questions
27
votes
9 answers

Debugging JConsole Connection Failed

I have a web application deployed to a remote resin server, and it has JMX turned on. I can telnet to the remote server i.e franz@see:/tmp$ telnet 5555 Trying ... Connected to . Escape character is…
Franz See
  • 3,282
  • 5
  • 41
  • 48
26
votes
4 answers

How to find the JMX port in a server?

I am sure I can figure it out if I can see the JAVA OPTS parameters. I want to monitor a hornetq server using Jconsole, so I need the port number. I remember using some command like java grep etc when I connected to it a while back.
user244333
26
votes
4 answers

Measuring Java execution time, memory usage and CPU load for a code segment

For a particular segment of Java code, I'd like to measure: Execution time (most likely thread execution time) Memory usage CPU load (specifically attributable to the code segment) I'm a relative Java novice and am not familiar with how this might…
Jon Cram
  • 16,609
  • 24
  • 76
  • 107
25
votes
5 answers

Is a good idea to enable jmx (lambda probe) on a production server?

We are experiencing some slowdowns on our web-app deployed on a Tomcat 5.5.17 running on a Sun VM 1.5.0_06-b05 and our hosting company doesn't gives enough data to find the problem. We are considering installing lambda probe on the production server…
Serxipc
  • 6,639
  • 9
  • 40
  • 51
24
votes
5 answers

Not able to Connect a Remote Host to the VisualVM

I am new to Java and I'm facing a problem in connecting a Remote Host to the JVisualVM. I've searched the Internet and followed all the steps mentioned there but still am not able to resolve the issue. The steps I followed are: I started the jstatd…
rushi
  • 545
  • 3
  • 7
  • 16
24
votes
7 answers

How to have JMX bind to a specific interface?

I am currently starting my Java VM with the com.sun.management.jmxremote.* properties so that I can connect to it via JConsole for management and monitoring. Unfortunately, it listens on all interfaces (IP addresses) on the machine. In our…
Marc Novakowski
  • 44,628
  • 11
  • 58
  • 63
23
votes
3 answers

Bypassing JConsole requirement for username/password - when using a Jaas custom login module with JMX to handle authorization and authentication

I'm using JConsole to access an MBean that is running. The MBean uses a custom Jaas login module and is run with the following command: java -classpath UserLGUGroupHandlingApplication.jar;MBeanSecure.jar…
Loco234
  • 521
  • 4
  • 20
22
votes
5 answers

List of JMX objects and attributes?

I am trying to implement a nagios plugin, and doing so requires that I know specifically what object and attribute I want to monitor. The thing is, I haven't been able to find a listing anywhere of the standard system jmx objects and attributes. Can…
Matthew
  • 512
  • 1
  • 6
  • 16
22
votes
3 answers

Have you used Perf4J to collect and analyze performance metrics in Java app?

Did you use Perf4J in your Java application to collect and analyze performance stats? What was the typical pattern (using log files, utilities, UI, JMX, etc.)? Did you use annotations and AOP-based features? Did you use any JMX integration? How…
topchef
  • 19,091
  • 9
  • 63
  • 102
22
votes
2 answers

Meaning of Spring @ManagerResource: persistPolicy, persistPeriod, persistLocation and currencyTimeLimit

What does the following fields mean in Spring @ManagedResource used for JMX? There is no Javadoc or related description in Spring documentation. 1. String persistPolicy() default ""; 2. int persistPeriod() default -1; 3. String…
Mohsen
  • 3,512
  • 3
  • 38
  • 66
21
votes
4 answers

JBoss AS 7 JMX Console

I spent some time checking out JBoss AS7 today. I am impressed with what I have seen so far but I noticed that good ol' JMX-Console no longer exist. Does anyone know why it was left out? I understand that I can connect through JConsole, MC4J etc.…
helios
  • 2,603
  • 4
  • 21
  • 26
21
votes
6 answers

Unable to use JConsole with Tomcat running as windows service

I am running tomcat 6.0.18 as a windows service. In the service applet the jvm is configured default, i.e. it is using jvm.dll of the JRE. I am trying to monitor this application with JConsole but cannot connect to it locally. I added the parameter…
Kees de Kooter
  • 7,078
  • 5
  • 38
  • 45
21
votes
1 answer

How do I give a name to a VisualVM ""?

JDK 1.6 comes bundled with a handy tool called VisualVM that lets you inspect and interact with running Java processes. One feature is that it auto-detects running JVMs on the local machine. Most are listed as " (pid xxxx)" but some have a name…
Chris Dolan
  • 8,905
  • 2
  • 35
  • 73
20
votes
3 answers

Difference between JMX and RMI

What is the purpose of JMX and what is it used for? I have been scanning through some of the tutorials on JMX and all they do is register some Mbeans and invoke those Mbeans from jconsole. If that is its purpose, then what is the difference between…
hnm
  • 789
  • 2
  • 9
  • 24
20
votes
4 answers

How do I access memory usage programmatically via JMX?

I'm looking for sample Java JMX code to access the values of JMX attributes from another VM. With JConsole, I have no problem looking at java.lang/Memory/Attributes/HeapMemory How would I get the same information from a Java program running in a…
ThoughtfulHacking
  • 1,189
  • 2
  • 8
  • 23