我在Camel 2.9.0。我能够查看JConsole中运行进程的MBean数据(路由、处理器等)。
我需要在我们的用户界面中显示相同的属性。当我试图获取属性值时,我得到了以下错误。
注意-属性“EndpointUri”正在获取正确的值。
问题出在“FirstExchangeCompletionTime”上。所以我的结论是,围绕服务器连接可能没有任何问题。当我们在Camel.1.6.4时,属性“FirstExchangeCompletedTimestamp”的同一行代码过去工作正常。在Camel1.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")
方法获取值。我浏览了Camel源代码,其中这些属性是通过org.apache.camel.management.mbean.Statistic
获得的。
我试过了(非静态方式)-
MBeanServerConnection::getAttribute(qName, "org.apache.camel.firstExchangeCompletedTimestamp")
MBeanServerConnection::getAttribute(qName, "firstExchangeCompletedTimestamp")
但好像都不管用。请帮帮忙。
2条答案
按热度按时间i7uaboj41#
请确保检查的属性值正确,错误显示为“FirstExchangeCompletionTime“,但属性名为“FirstExchangeCompletedTimestamp”
请参阅此单元测试以获取更多信息:
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java
xxslljrj2#
当我的工作站上的nodetool版本与我连接的Cassandra版本不同时,我遇到了这个问题。请确保您使用的是相同的版本。