Question

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

Was it helpful?

Solution 2

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

OTHER TIPS

Try the following url in JConsole, with Remote Process option: service:jmx:rmi:///jndi/rmi://localhost:8123/jmxrmi

It's a bit different than what I provided in the comments.

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

When you are using the registryPort configuration for JmxServer then it will not show up in the "Local Process" list under Jconsole. It will be able to be accessed as a "Remote Process" with localhost:8123. If you are on a Linux box, you might use netstat -an | grep LISTEN to see what ports your application is listening on. If you don't see 8123 in the list then maybe it already has a RMI server configured?

If you want to use the platform mbean-server which does show up as a local process then use the new setter or constructor in version 1.9 which was released recently (4/2014). Unfortunately, SimpleJMX cannot programmatically register itself so it shows up in the process list -- that's not code that the JVM exports.

<bean id="jmxServer" class="com.j256.simplejmx.server.JmxServer"
    init-method="start" destroy-method="stop">
    <property name="usePlatformMBeanServer" value="true" />
</bean>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top