Jmxtrans Jersey 查询引发异常

Jmxtrans Jersey 查询引发异常

我想在 Graphite 中绘制应用程序的使用情况统计图。我正在尝试启动并运行 Jmxtrans。我想要查询的对象是:

org.glassfish.jersey:type=my-server,subType=Uris,resource="/resource.js",executionTimes=RequestTimes

在我的配置中我有:

"obj": "org.glassfish.jersey:type=my-server,subType=Uris,resource=\"/resource.js\",executionTimes=RequestTimes"

但这会导致以下错误:

[06 Feb 2016 22:12:29] [jmxtrans-query-2] 363453 ERROR (com.googlecode.jmxtrans.jmx.ProcessQueryThread:57) - Error executing query Query(objectName=org.glassfish.jersey:type=reflow-ad-server,subType=Uris,resource=*,executionTimes=RequestTimes, keys=[], attr=[AverageTime[ms]_1m, RequestRate[requestsPerSeconds]_1m], typeNames=[], resultAlias=router_bootstrap_js, useObjDomainAsKey=false, allowDottedKeys=false, useAllTypeNames=false, outputWriterInstances=[BaseOutputWriter(typeNames=[name], debugEnabled=true, settings={}, valueTransformer=com.googlecode.jmxtrans.model.results.IdentityValueTransformer@6d2efbbd), com.googlecode.jmxtrans.model.output.support.ResultTransformerOutputWriter@27916d4b]) on server Server(pid=null, host=log-emea-5, port=9091, url=service:jmx:rmi:///jndi/rmi://log-emea-5:9091/jmxrmi, cronExpression=null, numQueryThreads=0)
java.lang.NullPointerException
        at com.googlecode.jmxtrans.model.Query.fetchResults(Query.java:195)
        at com.googlecode.jmxtrans.model.Server.execute(Server.java:239)
        at com.googlecode.jmxtrans.jmx.ProcessQueryThread.run(ProcessQueryThread.java:54)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

我尝试过不带引号的对象但不出所料,查询没有返回任何内容。

答案1

事实证明,对 javax.management.MBeanServerConnection.getAttributes(...) 的调用返回 null,但是在循环中对每个属性调用 javax.management.MBeanServerConnection.getAttribute(...) 可以正常工作。

看起来像是 javax.management.MBeanServerConnection.getAttributes(...) 中的一个错误,而不是 jmxtrans 本身的问题。

请参阅此代码以进行修复:

https://github.com/jmxtrans/jmxtrans/compare/master...jdudmesh:master

相关内容