YLombardi YLombardi - 1 year ago 337
Java Question

Jconsole cannot connect to local jmx application

I have a Spring boot project where I use spring-boot-starter-actuator and io.dropwizard.metrics.


It generates Metrics that I can access with the url http://myapplication/metrics.
I deploy the application on a Wildfly 10 standalone server.

I want to use jmx to read the metrics on jconsole.
I configure the application to send metrics with a JMXReporter :

public class MetricsConfiguration extends MetricsConfigurerAdapter {
public void configureReporters(MetricRegistry metricRegistry) {

When I start the server and deploy the application, logs say :

o.s.b.a.e.j.EndpointMBeanExporter Located managed bean
'metricsEndpoint': registering with JMX server as MBean

Server logs

When I run jconsole, in the Local Process list, there is only JConsole process and some grey PID. If I select a grey PID, it says "The management agent is not enable on this process".

I also tried to use the Remote Process connection :


But this doesn't work.

I tried to set the jvm variable :

  • -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false

and the property :

  • spring.jmx.enabled=true

It also doesn't work.

What can I do read jmx metrics with jconsole ?

Answer Source

I found a solution here : https://dzone.com/articles/remote-jmx-access-wildfly-or

My issue come from Wildfly. When I run jconsole, I need jboss-cli-client.jar and tools.jar to jconsole classpath :

$JAVA_HOME/bin/jconsole -J-Djava.class.path=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/jconsole.jar:/opt/wildfly-8.2.0.Final/bin/client/jboss-cli-client.jar

Now it works, I can use "service:jmx:remote+http://localhost:9990" to connect to jmx.