Skip to content
Advertisement

javax.management.AttributeNotFoundException

I am at Camel 2.9.0. I am able to view the MBean data(routes, processors, etc) for running processes in JConsole.

I need to display the same in our user interface. While I try to fetch the attribute values, I get the following error.

Note – Attribute “EndpointUri” is fetching the right value.

Problem is with “FirstExchangeCompletionTime”. So I am concluding that there might not be any possible problem revolving the server connection. When we were at Camel.1.6.4, the same line of code for the attribute “FirstExchangeCompletedTimestamp” used to work fine. Had there been any change in JMX set up after Camel 1.6.4?

We are using the following properties for our JMX setup:

-Dorg.apache.camel.jmx.disabled=false
-Dorg.apache.camel.jmx.rmiConnector.registryPort=2001

Error:

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)

We are fetching the values through MBeanServerConnection::getAttribute("X") method. I went through the Camel source code where these attributes are obtained through org.apache.camel.management.mbean.Statistic.

I tried (non-static way) –

MBeanServerConnection::getAttribute(qName, "org.apache.camel.firstExchangeCompletedTimestamp")
MBeanServerConnection::getAttribute(qName, "firstExchangeCompletedTimestamp")

But none seems to be working. Please help.

Advertisement

Answer

make sure you are checking for the correct attribute value, your errors says “FirstExchangeCompletionTime “, but the attribute is called “FirstExchangeCompletedTimestamp”

see this unit test for more info:

https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxInstrumentationUsingDefaultsTest.java

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement