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

2321 questions
238
votes
12 answers

How to activate JMX on my JVM for access with jconsole?

How to activate JMX on a JVM for access with jconsole?
Mauli
  • 15,951
  • 26
  • 80
  • 112
122
votes
10 answers

How do you Force Garbage Collection from the Shell?

So I am looking at a heap with jmap on a remote box and I want to force garbage collection on it. How do you do this without popping into jvisualvm or jconsole and friends? I know you shouldn't be in the practice of forcing garbage collection -- you…
eyberg
  • 2,960
  • 5
  • 24
  • 41
122
votes
20 answers

Has anyone ever got a remote JMX JConsole to work?

It seems that I've never got this to work in the past. Currently, I KNOW it doesn't work. But we start up our Java…
Will Hartung
  • 107,347
  • 19
  • 121
  • 195
104
votes
9 answers

Calling JMX MBean method from a shell script

Are there any libraries that would allow me to call a JMX MBean method from a shell script. We expose some operations/admin commands through JMX, and we could have our admins use JConsole, or VisualVM, but some tasks are better left to automation.…
Dougnukem
  • 14,091
  • 23
  • 86
  • 129
98
votes
12 answers

Remote JMX connection

I'm trying to open a JMX connection to java application running on a remote machine. The application JVM is configured with the following…
tuler
  • 3,084
  • 5
  • 30
  • 42
81
votes
3 answers

Explain JMX URL

I am trying to understand a JMX service URL. service:jmx:rmi://192.168.30.10:1234/jndi/rmi://192.168.30.10:2344/jmxrmi It would be great, if someone can help me understand this. Thanks
priyank
  • 4,166
  • 10
  • 41
  • 51
78
votes
6 answers

How do I attach VisualVM to a simple Java process running in a Docker container

Actually I wanted a solution working for JEE containers, specifically for Glassfish, but after I tried many combinations of settings and did not succeed, I reduced the setup to the simplest possible case. Here is my Hello World daemon started in a…
nolexa
  • 2,132
  • 1
  • 16
  • 19
67
votes
4 answers

JConsole over ssh local port forwarding

I'd like to be able to remotely connect to a Java service that has JMX exposed, however it is blocked by a firewall. I have tried to use ssh local port forwarding, however the connection fails. Looking at wireshark, it appears that when you try to…
blockcipher
  • 1,984
  • 4
  • 20
  • 32
63
votes
3 answers

Why Java opens 3 ports when JMX is configured?

I run my Java program with JDK7 on Centos6. I enable JMX using the following options: JAVA_OPTS="${JAVA_OPTS} -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9123 -Dcom.sun.management.jmxremote.ssl=false…
Michael
  • 9,061
  • 16
  • 53
  • 96
58
votes
10 answers

Unable to remotely connect to JMX?

For some weird reason I am not able to connect using VisualVM or jconsole to a JMX. The parameters used to start the VM to be monitored: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false…
sorin
  • 137,198
  • 150
  • 472
  • 707
56
votes
12 answers

Connecting remote tomcat JMX instance using jConsole

I am trying to connect to a remote tomcat JMX instance using jConsole. But can't connect successfully. Any Idea? I included the following option in remote tomcat catalina.sh: JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote \ …
Niger
  • 3,646
  • 5
  • 26
  • 29
55
votes
1 answer

How to find the default JMX port number?

I am running a Java application on Java 6 VM on a remote Windows XP, on which I can run jvisualvm.exe to connect to the running application automatically. Now I need to connect that application from my local computer, but I don't know the JMX port…
chance
  • 5,735
  • 11
  • 39
  • 68
51
votes
4 answers

Difference between MBean and MXBean

I have the following questions regarding MBean and MXBean: What is the difference between MBean and MXBean? What are the use cases for MBean and MXBean?
Denim Datta
  • 3,528
  • 3
  • 25
  • 53
50
votes
6 answers

What is the best or most commonly used JMX Console / Client

I have a server application that has been instrumented using JMX so that it can be monitored in test and production environments. I wish to show the current value of some JMX exposed attributes as well as the long term trends in a graphical…
Keith Lyall
  • 1,075
  • 2
  • 9
  • 8
44
votes
5 answers

How to connect to a java program on localhost jvm using JMX?

I should connect to a java program on localhost jvm using JMX. In other words I want to develop a JMX client to config a java program on localhost. Don't recommend using JConsole! JConsole is not suitable because it is general JMX client and have…
mjafari
  • 674
  • 2
  • 12
  • 22
1
2 3
99 100