Reputation: 10139
I can register a Class into MBean but could not connect via jconsole. Why I could not connect running this application though I have disabled the jmx authentication via JVM parameters.
Here is my java Classes, spring property file and JVM parameters
package com.mkyong.jmx;
public interface JmxCoreComands {
public void start();
public void stop();
public void report();
}
package com.mkyong.jmx;
import org.springframework.stereotype.Service;
@Service
public class JmxService implements JmxCoreComands {
@Override
public void start() {
System.out.println("Jmx Service start");
}
@Override
public void stop() {
System.out.println("jmx service stop");
}
@Override
public void report() {
System.out.println("jmx service report");
}
}
Spring property XML:
<bean id="jmxAdapter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false">
<property name="beans">
<map>
<entry key="SPRING:Name=TestRun">
<ref bean="jmxService" />
</entry>
</map>
</property>
<!-- managemethods property starts -->
<property name="assembler">
<bean
class="org.springframework.jmx.export.assembler.InterfaceBasedMBeanInfoAssembler">
<property name="managedInterfaces">
<value>com.mkyong.jmx.JmxCoreComands</value>
</property>
</bean>
</property>
<!-- managemethods property ends -->
</bean>
JVM Parameters:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8014
-Dcom.sun.management.jmxremote.authenticate=false
-Xmx1024M
-Xdebug
-Xnoagent
-Xrunjdwp:transport=dt_socket,address=8454,server=y,suspend=n
-Djava.compiler=NONE
Upvotes: 0
Views: 693
Reputation: 10139
After changed my JVM configuration as following I am able to connect the application over JMX.
-Djava.rmi.server.hostname=127.0.0.1
-Dcom.sun.management.jmxremote.port=8014
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Upvotes: 2