我在骆驼2.9.0。我能够在 JConsole 中查看正在运行的进程的 MBean 数据(路由、处理器等)。
我需要在我们的用户界面中显示相同的内容。当我尝试获取属性值时,出现以下错误。
注意 - 属性“EndpointUri”正在获取正确的值。
问题在于“FirstExchangeCompletionTime”。所以我的结论是,旋转服务器连接可能没有任何问题。当我们在 Camel.1.6.4 时,属性“FirstExchangeCompletedTimestamp”的同一行代码过去可以正常工作。Camel 1.6.4 之后的 JMX 设置是否有任何变化?
我们在 JMX 设置中使用以下属性:
-Dorg.apache.camel.jmx.disabled=false
-Dorg.apache.camel.jmx.rmiConnector.registryPort=2001
错误:
javax.management.AttributeNotFoundException: getAttribute failed: ModelMBeanAttributeInfo not found for FirstExchangeCompletionTime
> at javax.management.modelmbean.RequiredModelMBean.getAttribute(RequiredModelMBean.java:1326)
> at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:666)
> at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:638)
> at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1404)
> at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
> at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265)
> at java.security.AccessController.doPrivileged(Native Method)
> at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1367)
> at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:600)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
> at sun.rmi.transport.Transport$1.run(Transport.java:159)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
> at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
> at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
> at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
> at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
> at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source)
> at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:878)
我们正在通过MBeanServerConnection::getAttribute("X")
方法获取值。我浏览了骆驼源代码,这些属性是通过 org.apache.camel.management.mbean.Statistic
.
我试过(非静态方式) -
MBeanServerConnection::getAttribute(qName, "org.apache.camel.firstExchangeCompletedTimestamp")
MBeanServerConnection::getAttribute(qName, "firstExchangeCompletedTimestamp")
但似乎没有一个工作。请帮忙。