Beim Versuch, Werte von Attributen für ManagedExecutorService von Hazelcast abzurufen, erhalte ich den Fehler ReflectionException. Mit JConsole kann ich normalerweise Werte sehen.Fehler beim Abrufen des JMX-Attributwerts für Hazelcast
String connectionUrl = "service:jmx:http-remoting-jmx://127.0.0.1:9990";
JMXServiceURL url = new JMXServiceURL(connectionUrl);
Map<String, Object> auth = new HashMap<>();
String[] credentials = new String[] {"developer", "developer"};
auth.put (JMXConnector.CREDENTIALS, credentials);
JMXConnector jmxc = JMXConnectorFactory.connect(url, auth);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
try {
ObjectName objectName = new ObjectName("com.hazelcast:instance=_hzInstance_1_dev,name=\"hz:async\","
+ "type=HazelcastInstance.ManagedExecutorService");
MBeanInfo info = mbsc.getMBeanInfo(objectName);
mbsc.getAttribute(objectName, "eventQueueSize"); //exception here
//AttributeList lst =
// mbsc.getAttributes(objectName, new String[]{"eventQueueSize", "completedTaskCount"}); // and here
//System.out.println(lst);
} finally {
jmxc.close();
}
Ausnahme:
Exception in thread "main" javax.management.ReflectionException
at com.hazelcast.jmx.HazelcastMBean.getAttribute(HazelcastMBean.java:115)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
at org.jboss.as.jmx.PluggableMBeanServerImpl$TcclMBeanServer.getAttribute(PluggableMBeanServerImpl.java:1390)
at org.jboss.as.jmx.PluggableMBeanServerImpl.getAttribute(PluggableMBeanServerImpl.java:393)
at org.jboss.as.jmx.BlockingNotificationMBeanServer.getAttribute(BlockingNotificationMBeanServer.java:148)
at org.jboss.remotingjmx.protocol.v2.ServerProxy$GetAttributeHandler.handle(ServerProxy.java:691)
at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1$1.run(ServerCommon.java:153)
at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor$1.run(ServerInterceptorFactory.java:75)
at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor$1.run(ServerInterceptorFactory.java:70)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:94)
at org.jboss.as.jmx.ServerInterceptorFactory$Interceptor.handleEvent(ServerInterceptorFactory.java:70)
at org.jboss.remotingjmx.protocol.v2.ServerCommon$MessageReciever$1.run(ServerCommon.java:149)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
Sie sind sicher, dass der Attributname eventQueueSize und nicht EventQueueSize ist? – Nicholas
@Nicholas oops, meine Schuld. Schreibe deinen Kommentar als Antwort – Rustam