在kafka Connect Contruent图像上使用JMX出口商在代理加载时间上投掷NosuchfieldException

发布于 2025-02-10 09:17:12 字数 2398 浏览 3 评论 0 原文

我目前正在triy to揭露kafka connect workers jmx:

使用此docker映像:

FROM cnfldemos/cp-server-connect-datagen:0.5.3-7.1.0
ADD --chown=1000:1000 exporterConfig.yml /opt/prometheus-exporter/prom-jmx-agent-config.yml
ADD --chown=1000:1000 jmx_prometheus_javaagent-0.17.0.jar /opt/prometheus-exporter/agent.jar

jmx offorter版本是最后一个来自0的jmx exporter版本,

这是连接工人开始启动时的结果日志:

PS D:\env\confluent-platform> docker logs connect -f
===> User
uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
===> Configuring ...
===> Running preflight checks ...
===> Check if Kafka is healthy ...
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.NoSuchFieldError: UNKNOWN
        at io.prometheus.jmx.JmxCollector$Rule.<init>(JmxCollector.java:57)
        at io.prometheus.jmx.JmxCollector.loadConfig(JmxCollector.java:214)
        at io.prometheus.jmx.JmxCollector.<init>(JmxCollector.java:91)
        at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)
        ... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed

this java.lang.lang.nosuchfielderror让我思考依赖关系冲突问题,

我浏览了JMX Exporter&amp;它的simpleclient 依赖项

确实,实际上是从collector.java类中的SimpleClient inum inum inum inum inum inum inm in collector.java类中仅出现在版本10之后10之后才出现,14是JMX出口商中的依赖项编号。

但是我采用了cnfldemos/cp-server-connect-datagen的源代码,但我无法找到对此依赖项软件包的任何参考。

欢迎任何建议!

I'm currently triying to expose Kafka Connect Workers JMX :

Using this docker image :

FROM cnfldemos/cp-server-connect-datagen:0.5.3-7.1.0
ADD --chown=1000:1000 exporterConfig.yml /opt/prometheus-exporter/prom-jmx-agent-config.yml
ADD --chown=1000:1000 jmx_prometheus_javaagent-0.17.0.jar /opt/prometheus-exporter/agent.jar

The JMX Exporter version is the last one from 0

Here is the result logs when the connect worker is starting :

PS D:\env\confluent-platform> docker logs connect -f
===> User
uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
===> Configuring ...
===> Running preflight checks ...
===> Check if Kafka is healthy ...
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.NoSuchFieldError: UNKNOWN
        at io.prometheus.jmx.JmxCollector$Rule.<init>(JmxCollector.java:57)
        at io.prometheus.jmx.JmxCollector.loadConfig(JmxCollector.java:214)
        at io.prometheus.jmx.JmxCollector.<init>(JmxCollector.java:91)
        at io.prometheus.jmx.JavaAgent.premain(JavaAgent.java:29)
        ... 6 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed

This java.lang.NoSuchFieldError make me think about dependency conflict issue,

I got through the code of JMX Exporter & its simpleclient dependency

indeed the UNKNOWN Type enum value from simpleclient dependency in Collector.java class only appeared after version 10, and 14 is the dependency version number in JMX Exporter.

But i took the source code of the cnfldemos/cp-server-connect-datagen and i was not able to find any reference to this dependency package.

Any advice welcome !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嗼ふ静 2025-02-17 09:17:12

如果您检查了

您会注意到,您必须设置以下环境变量才能启用JMX

  1. KAFKA_JMX_OPTS
  2. KAFKA_JMX_HOSTNAME(如果未指定,则将以当前hostname为单位)
  3. KAFKA_JMX_ PORT

您所遇到的问题,因为您指定了 kafka_jmx_opts ,默认情况下JMX身份验证是已启用。为了禁用它,它使用此标志 -dcom.sun.management.jmxremote.authenticate = false

我通过以下配置解决了此问题:

  KAFKA_JMX_OPTS: -javaagent:/usr/share/java/kafka-connect-sample/jmx_prometheus_javaagent-0.17.2.jar=8080:/usr/share/java/kafka-connect-sample/prometheus-kafka-connect.yml -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

If you check the source code of the
confluent kafka-connect images

You will notice that, you have to set the following environment variables to enable JMX

  1. KAFKA_JMX_OPTS
  2. KAFKA_JMX_HOSTNAME (optional, if not specified it will take the current hostname)
  3. KAFKA_JMX_PORT

The issue you are facing is because when you specify the KAFKA_JMX_OPTS, by default the jmx authentication is enabled. To disable it use this flag -Dcom.sun.management.jmxremote.authenticate=false

I resolved this issue with following configuration:

  KAFKA_JMX_OPTS: -javaagent:/usr/share/java/kafka-connect-sample/jmx_prometheus_javaagent-0.17.2.jar=8080:/usr/share/java/kafka-connect-sample/prometheus-kafka-connect.yml -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文