Debezium CDC 连接器在 java.library.path 中说没有 ocijdbc11

Debezium CDC connector says no ocijdbc11 in java.library.path

我正在尝试部署 debezium CDC 连接器以从 Oracle DB 捕获数据。我们已经准备好 Oracle DB 和 Xstream 连接器。

我遇到以下异常:

{
 "name": "test-debezium-2",
 "connector": {
   "state": "RUNNING",
   "worker_id": "10.230.24.80:8084"
 },
 "tasks": [
   {
     "id": 0,
     "state": "FAILED",
     "worker_id": "10.230.24.80:8084",
     "trace": "org.apache.kafka.connect.errors.ConnectException: An exception ocurred in the change event producer. This connector will be stopped.\n\tat 
               io.debezium.connector.base.ChangeEventQueue.throwProducerFailureIfPresent(ChangeEventQueue.java:170)\n\tat 
               io.debezium.connector.base.ChangeEventQueue.poll(ChangeEventQueue.java:151)\n\tat 
               io.debezium.connector.oracle.OracleConnectorTask.poll(OracleConnectorTask.java:110)\n\tat 
               org.apache.kafka.connect.runtime.WorkerSourceTask.poll(WorkerSourceTask.java:259)\n\tat 
               org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:226)\n\tat 
               org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)\n\tat 
               org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)\n\tat 
               java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat 
               java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat 
               java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat 
               java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat 
               java.base/java.lang.Thread.run(Thread.java:834)\n
                   Caused by: java.lang.UnsatisfiedLinkError: no ocijdbc11 in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]\n\tat 
                   java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2660)\n\tat 
                   java.base/java.lang.Runtime.loadLibrary0(Runtime.java:829)\n\tat 
                   java.base/java.lang.System.loadLibrary(System.java:1867)\n\tat 
                   oracle.jdbc.driver.T2CConnection.run(T2CConnection.java:3541)\n\tat 
                   java.base/java.security.AccessController.doPrivileged(Native Method)\n\tat 
                   oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3537)\n\tat 
                   oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:269)\n\tat 
                   oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:553)\n\tat 
                   oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:165)\n\tat 
                   oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)\n\tat 
                   oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)\n\tat 
                   java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)\n\tat 
                   java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)\n\tat 
                   io.debezium.connector.oracle.OracleConnectionFactory.connect(OracleConnectionFactory.java:25)\n\tat 
                   io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:756)\n\tat 
                   io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:751)\n\tat 
                   io.debezium.connector.oracle.OracleConnection.setSessionToPdb(OracleConnection.java:46)\n\tat 
                   io.debezium.connector.oracle.OracleSnapshotChangeEventSource.prepare(OracleSnapshotChangeEventSource.java:70)\n\tat 
                   io.debezium.relational.RelationalSnapshotChangeEventSource.execute(RelationalSnapshotChangeEventSource.java:104)\n\tat 
                   io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start[=11=](ChangeEventSourceCoordinator.java:83)\n\t... 5 more\n"
   }
 ],
 "type": "source"
}

我已验证 /usr/lib 文件夹中有 ocijdbc11.dll 文件。我也尝试将文件复制到 /lib,但我遇到了同样的错误。

我遇到了这个问题。 先去oracle下载'instantclient' instantclient download

unzip------相信你已经将ojdbc.jar和xtream.jar复制到kafka lib.

然后添加环境变量

vim /etc/profile

添加:

exprot LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/you download file addr/libocijdbc11.so

保存----wq!

ohhhhhh,记住---资源/etc/profile

运行 再一次