aws-samples / msk-connect-custom-plugin-jmx

MIT No Attribution
3 stars 1 forks source link

JMXMetricsExporter failed in MSK Connect #2

Open tkionshao opened 3 months ago

tkionshao commented 3 months ago

Hi,

I run this connector via MSK Connect, but receiving the error at this line in the code. Can help to check why it failed?

https://github.com/aws-samples/msk-connect-custom-plugin-jmx/blob/main/custom_module/src/main/java/com/amazonaws/msk/debezium/mysql/JMXMetricsExporter.java#L102

msBehindSource = mxbeanProxy.getMilliSecondsBehindSource();
Logs

1723609317000,"[Worker-01ef849f4d1a7f9cf] [2024-08-14 04:21:57,173] INFO [t240814-1215|worker] JMX URL : service:jmx:rmi://localhost/jndi/rmi://localhost:7098/jmxrmi (com.amazonaws.msk.debezium.mysql.connect.JMXMetricsExporter:93)" 1723609317000,"[Worker-01ef849f4d1a7f9cf] [2024-08-14 04:21:57,200] INFO [t240814-1215|worker] Connected to JMX Server Successfully (com.amazonaws.msk.debezium.mysql.connect.JMXMetricsExporter:96)" 1723609317000,"[Worker-01ef849f4d1a7f9cf] [2024-08-14 04:21:57,201] INFO [t240814-1215|worker] Object Name : debezium.mysql:type=connector-metrics,context=streaming,server=mysql (com.amazonaws.msk.debezium.mysql.connect.JMXMetricsExporter:100)" 1723609317000,"[Worker-01ef849f4d1a7f9cf] Exception in thread ""Timer-0"" java.lang.reflect.UndeclaredThrowableException" 1723609317000,[Worker-01ef849f4d1a7f9cf] at com.sun.proxy.$Proxy45.getMilliSecondsBehindSource(Unknown Source) 1723609317000,[Worker-01ef849f4d1a7f9cf] at com.amazonaws.msk.debezium.mysql.connect.JMXMetricsExporter.getMSBehindSourceMetric(JMXMetricsExporter.java:103) 1723609317000,[Worker-01ef849f4d1a7f9cf] at com.amazonaws.msk.debezium.mysql.connect.JMXMetricsExporter.run(JMXMetricsExporter.java:41) 1723609317000,[Worker-01ef849f4d1a7f9cf] at com.amazonaws.msk.debezium.mysql.connect.Scheduler$1.run(Scheduler.java:16) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.util.TimerThread.mainLoop(Timer.java:556) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.util.TimerThread.run(Timer.java:506) 1723609317000,"[Worker-01ef849f4d1a7f9cf] Caused by: javax.management.InstanceNotFoundException: debezium.mysql:type=connector-metrics,context=streaming,server=mysql" 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1083) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:637) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1443) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:637) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.lang.reflect.Method.invoke(Method.java:566) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.security.AccessController.doPrivileged(Native Method) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.security.AccessController.doPrivileged(Native Method) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.base/java.lang.Thread.run(Thread.java:829) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:303) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:279) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:164) 1723609317000,[Worker-01ef849f4d1a7f9cf] at jdk.remoteref/jdk.jmx.remote.internal.rmi.PRef.invoke(Unknown Source) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management.rmi/javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:904) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management/com.sun.jmx.mbeanserver.MXBeanProxy$GetHandler.invoke(MXBeanProxy.java:122) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management/com.sun.jmx.mbeanserver.MXBeanProxy.invoke(MXBeanProxy.java:167) 1723609317000,[Worker-01ef849f4d1a7f9cf] at java.management/javax.management.MBeanServerInvocationHandler.invoke(MBeanServerInvocationHandler.java:258) 1723609317000,[Worker-01ef849f4d1a7f9cf] ... 6 more

techy-sharmila commented 1 month ago

Hi, Apologies for the delay in responding. Based on the below statement, the error has occurred as the bean name can not be found in the MBeanServer. Caused by: javax.management.InstanceNotFoundException: debezium.mysql:type=connector-metrics,context=streaming,server=mysql Bean name is of the form debezium.mysql:type=connector-metrics,context=streaming,server=. Can you ensure that your database name (should be mysql from the above error) matches with the below properties in your connector configuration and retry this? database.server.name and topic.prefix

Please share your connector configuration if you still face the issue.