How to connect SpringBoot JMX beans with Jolokia?

醉酒当歌 提交于 2019-12-11 05:24:32

问题


I'm using @EnableMBeanExport in a SpringBoot application to make my beans with @ManagedResource be available to the JMX server. This works fine in simple local processes with VisualVM.

I'm now trying to add Jolokia into the mix, so I can reference those beans remotely with a REST service instead of setting up a remote RMI connection, which is annoying.

The Jolokia doc page at https://jolokia.org/reference/html/jmx.html says to use the following:

MBeanServer jolokiaServer = JolokiaMBeanServerUtil.getJolokiaMBeanServer();

However, there doesn't appear to be a "JolokiaMBeanServerUtil" class in Jolokia.

Update:

Ok, I found the artifact with the class, but the solution doesn't appear to be as simple as just declaring a bean with this value. When I attempt to call a jmx method with a jolokia url, I get an exception like the following:

java.lang.IllegalArgumentException: Invalid object name. Key properties cannot be empty
    at org.jolokia.request.JmxRequestFactory.createGetRequest(JmxRequestFactory.java:99)
    at org.jolokia.http.HttpRequestHandler.handleGetRequest(HttpRequestHandler.java:79)
    at org.jolokia.http.AgentServlet$4.handleRequest(AgentServlet.java:470)

来源:https://stackoverflow.com/questions/55408935/how-to-connect-springboot-jmx-beans-with-jolokia

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!