Quarkus JMX monitoring
Hello, team
I'm new to Quarkus and I'm trying to migrate our small connector application from Spring to Quarkus. But The main issue that I'm stuck with - is it possible to access application MBeans via remote jmx connection. My application has code that registers custom MBean and also I added micrometer dependency to observe monitoring MBeans. I started application via IntelliJ runner with following vm options
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote.host=0.0.0.0 -Djava.rmi.server.hostname=0.0.0.0 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false
If I connect jconsole as to local process I can observe my custom MBean domain and 'meter' domain
But if I connect as to remote process neither of domains I don't observe. Could you point me out what I'm doing wrong
Also when I tried to run application in production mode (java -jar ....) vm options didn't apply at all.
/cc @brunobat (micrometer), @ebullient (metrics,micrometer), @jmartisk (metrics)
@marichka-spin are you also setting those jmx properties when you run with java -jar... ?
@brunobat
I'm doing:
java -jar ./target/quarkus-app/quarkus-run.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote.host=0.0.0.0 -Djava.rmi.server.hostname=0.0.0.0 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false
Options seems to not applied at all, jconsole is not connecting to remote process with param 'localhost:9090'
The command looks ok, it works for me on Linux and Temurin 21:
Can you please add a reproducer project to this issue?
Hello, @brunobat
My set up is MacOS and Azul jdk 17
So I created test project https://github.com/marichka-spin/jmx-with-quarkus
What I did
java -jar ./target/quarkus-app/quarkus-run.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote.host=0.0.0.0 -Djava.rmi.server.hostname=0.0.0.0 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false
then I run
jconsole localhost:9090
I've got - Connection refused
If I connect as local process - everything is ok. But I case with java code:
JMXServiceURL url = new JMXServiceURL(String.format(CONNECTION_STRING_TEMPLATE,"localhost:9090")); JMXConnector jmxc = JMXConnectorFactory.connect(url, new HashMap<>()); MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); log.info("MBeanServer default domain = " + mbsc.getDefaultDomain()); return mbsc;
I also can't connect
Hi @brunobat, In one of the previous issues, I found that Quarkus doesn't support JMX but that was an old comment. I was trying to connect jmx for my application (Keycloak 21.1.2.4.6 + Quarkus 2.13.8.Final) but facing a problem. More details over here: Error Details
Wanted to check if its supported now and specifically from which version onwards? Thanks!
Hi @brunobat, In one of the previous issues, I found that Quarkus doesn't support JMX but that was an old comment. I was trying to connect jmx for my application (Keycloak 21.1.2.4.6 + Quarkus 2.13.8.Final) but facing a problem. More details over here: Error Details
Wanted to check if its supported now and specifically from which version onwards? Thanks!
That issue is about JMX on native mode. It's not the case here.
Hello, @brunobat My set up is MacOS and Azul jdk 17 So I created test project https://github.com/marichka-spin/jmx-with-quarkus What I did
java -jar ./target/quarkus-app/quarkus-run.jar -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote.host=0.0.0.0 -Djava.rmi.server.hostname=0.0.0.0 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=falsethen I runjconsole localhost:9090I've got - Connection refusedIf I connect as local process - everything is ok. But I case with java code:
JMXServiceURL url = new JMXServiceURL(String.format(CONNECTION_STRING_TEMPLATE,"localhost:9090")); JMXConnector jmxc = JMXConnectorFactory.connect(url, new HashMap<>()); MBeanServerConnection mbsc = jmxc.getMBeanServerConnection(); log.info("MBeanServer default domain = " + mbsc.getDefaultDomain()); return mbsc;I also can't connect
@marichka-spin, sorry, but your command worked for me on Fedora 42 Linux, using Temurin 21. Please try other JDK, operating system or double-check your firewall.
If I connect as local process - everything is ok. But I case with java code: