kafka SAP Hana 连接器-java.lang.NoClassDefFoundError

kafka SAP Hana 连接器-java.lang.NoClassDefFoundError

我正在为 SAP Hana 配置一个 kafka 连接器。配置连接器后,我通过浏览到http://localhost:8083/connectors/sapHana-source/status,但我发现它失败了:

{
  "name": "sapHana-source",
  "connector": {
    "state": "RUNNING",
    "worker_id": "127.0.1.1:8083"
  },
  "tasks": [
    {
      "id": 0,
      "state": "FAILED",
      "worker_id": "127.0.1.1:8083",
      "trace": "java.lang.BootstrapMethodError:     java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction0$mcV$sp\n\tat     com.sap.kafka.connect.source.GenericSourceTask.start(GenericSourceTask.scala:34)\n\tat     org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:199)\n\tat org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:175)\n\tat org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:219)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\n\tat java.lang.Thread.run(Thread.java:748)\nCaused by: java.lang.NoClassDefFoundError: scala/runtime/java8/JFunction0$mcV$sp\n\t... 9 more\nCaused by: java.lang.ClassNotFoundException: scala.runtime.java8.JFunction0$mcV$sp\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:382)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:424)\n\tat org.apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.java:104)\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:357)\n\t... 9 more\n"
    }
  ],
  "type": "source"
}

我正在用以下命令配置连接器:

curl -H "Accept: application/json" -H "Content-Type: application/json" -sX PUT "localhost:8083/connectors/sapHana-source/config" -d @SapHana_Source_Connector.json | jq

SapHana_Source_Connector.json 的内容为:

{

"connector.class": "com.sap.kafka.connect.source.hana.HANASourceConnector",

"tasks.max": "1",

"topics":"sap-stock-inv",

"mode": "bulk",

"connection.url": "jdbc:sap://10.80.134.204:30015/?trace=traceFile.txt",

"connection.user": "DSD_USER",

"connection.password": "Init123*",

"sap-stock-inv.table.name": "\"_SYS_BIC\".\"PVH.POSDTA.InventoryVisibility.Store/ODATA_INV_VIS_EAN_NEXT_GR\""

}

当我运行此命令时,我收到一条成功消息。(相同的 JSON 被打印回控制台)。我还确认,当我故意将 Connector.class 设置为无效值时,我会收到一条错误消息。

我尝试过的步骤:

  • 将此行添加到/etc/环境文件: 导出 CLASSPATH=“/home/jpathe/Desktop/confluent-5.2.1/confluent-5.2.1/share/java”
  • 将此行添加到/etc/kafka/connect-distributed.properties/etc/kafka/connect-standalone.properties:plugin.path=/home/jpathe/Desktop/confluent-5.2.1-web/confluent-5.2.1/share/java

有谁知道我该如何解决NoClassDefFoundError?

答案1

在 Linux 上编译 JAR 文件后,此方法有效

相关内容