错误:java.lang.IncompatibleClassChangeError:类com.typesafe.scalalogging.BaseLogger无法实现com.typesafe.scalalogging.Logger

我正在配置接收器-influxDB,我遇到了以上错误。
使用kafka-connect-influxdb-1.2.0.jar,其他受支持的jar是

kcql-2.4.0.jar
influxdb-java-2.15.jar
scala-logging_2.11-3.9.0.jar
scala-logging-slf4j_2.11-2.1.2.jar
scala-logging-api_2.11-2.1.2.jar


来自scala-logging-api_2.11-2.1.2.jar的com.typesafe.scalalogging.BaseLogger正在实现com.typesafe.scalalogging.Logger

这是异常堆栈

ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectStandalone:130)
java.lang.IncompatibleClassChangeError: class com.typesafe.scalalogging.BaseLogger can not implement com.typesafe.scalalogging.Logger, because it is not an interface (com.typesafe.scalalogging.Logger is in unnamed module of loader 'app')
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:802)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:700)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:623)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
        at java.base/java.lang.Class.getConstructor0(Class.java:3342)
        at java.base/java.lang.Class.newInstance(Class.java:556)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.versionFor(DelegatingClassLoader.java:380)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.getPluginDesc(DelegatingClassLoader.java:350)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanPluginPath(DelegatingClassLoader.java:330)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanUrlsAndAddPlugins(DelegatingClassLoader.java:263)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initPluginLoader(DelegatingClassLoader.java:211)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initLoaders(DelegatingClassLoader.java:204)
        at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:60)
        at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:79)


任何线索,谢谢?



我已经用kafka-connect-influxdb-2.0.0-2.4.0-all.jar替换了kafka connect jar,并修改了worker属性以支持String的键,值为AVRO,如下所示

key.converter=org.apache.kafka.connect.storage.StringConverter
key.converter.schemas.enable=false

value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://localhost:8081
value.converter.schemas.enable=true


启动连接器时,抛出以下错误

INFO [Consumer clientId=connector-consumer-influxdb-sink-0, groupId=connect-influxdb-sink] Resetting offset for partition TEST-0 to offset 11. (org.apache.kafka.clients.consumer.internals.SubscriptionState:385)
[2020-05-06 04:09:11,490] ERROR WorkerSinkTask{id=influxdb-sink-0} Task threw an uncaught and unrecoverable exception. Task is being killed and will not recover until manually restarted. (org.apache.kafka.connect.runtime.WorkerSinkTask:559)
java.lang.IncompatibleClassChangeError: Class com.landoop.json.sql.JacksonJson$$anon$1 does not implement the requested interface com.fasterxml.jackson.module.scala.ScalaObjectMapper
    at com.fasterxml.jackson.module.scala.ScalaObjectMapper.$init$(ScalaObjectMapper.scala:338)
    at com.landoop.json.sql.JacksonJson$$anon$1.<init>(JacksonJson.scala:25)
    at com.landoop.json.sql.JacksonJson$.<init>(JacksonJson.scala:25)
    at com.landoop.json.sql.JacksonJson$.<clinit>(JacksonJson.scala)
    at com.datamountaineer.streamreactor.connect.influx.converters.SinkRecordParser$.$anonfun$build$2(SinkRecordParser.scala:59)
    at scala.util.Try$.apply(Try.scala:213)
    at com.datamountaineer.streamreactor.connect.influx.converters.SinkRecordParser$.build(SinkRecordParser.scala:59)
    at com.datamountaineer.streamreactor.connect.influx.writers.InfluxBatchPointsBuilder.$anonfun$build$1(InfluxBatchPointsBuilder.scala:90)


有任何线索吗?,谢谢

最佳答案

尝试:

import com.typesafe.scalalogging.LazyLogging


代替:

import com.typesafe.scalalogging.slf4j.LazyLogging


这应该可以解决以下错误:

class com.typesafe.scalalogging.BaseLogger can not implement com.typesafe.scalalogging.Logger, because it is not an interface

10-04 21:56