Search code examples
javaspringjmxjconsolesimplejmx

JmxResource published with simplejmx does not appear in JConsole


I am using simplejmx to publish my JMX Resources.

I have got jmx-config.xml

<bean id="beanPublisher" class="com.j256.simplejmx.spring.BeanPublisher">
    <property name="jmxServer" ref="jmxServer" />
</bean>

<bean id="jmxServer" class="com.j256.simplejmx.server.JmxServer"
    init-method="start" destroy-method="stop">
    <property name="registryPort" value="8123" />
</bean>

I am starting my JBoss application, everything is ok:

15:20:11,860 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (MSC service thread 1-8) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1be30160: defining beans [...,beanPublisher,jmxServer,...]; root of factory hierarchy

I created a simply class.

package com.mypckg.jmx;

import com.j256.simplejmx.common.JmxAttributeField;
import com.j256.simplejmx.common.JmxResource;

@JmxResource(description = "Blah1", domainName = "Blah2", beanName = "Blah3")
public class DummyJMX {

    @JmxAttributeField(description = "Blah4")
    private int var = 3;
}

I am starting JConsole, I am choosing JBoss application and I am going to MBeans. That is what I see:

enter image description here *

Probably, my DummyJMX class has not been published (or I just cannot find it).

About which step I forgot?

Thank you in advance


EDIT :

enter image description here


EDIT :

@Andrei Stefan

An error which I got using your link:

enter image description here

@Gray

An error which I got using localhost:8123:

enter image description here


Solution

  • Finally, I am connected to my JMX Beans using JConsole.

    Probably, I did something wrong in the beginning of my work with simplejmx.

    I have not changed a lot of things. I kept jmx-config file and I still use version 1.8 of simplejmx.

    I can easily connect to this bean locally - I have no idea why I was not able to do that earlier. Could you tell me, why in your opinion it should not be a local process?

    Below, you can see that my JMX Bean appears in JConsole:

    enter image description here