Search code examples
oracleapache-kafka-connectdebeziumoracle-cdc

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


I am trying to deploy debezium CDC connector to capture data from Oracle DB. We have prepared the Oracle DB and Xstream connector.

I am getting following exception:

{
 "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$1.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$0(ChangeEventSourceCoordinator.java:83)\n\t... 5 more\n"
   }
 ],
 "type": "source"
}

I have verified the /usr/lib folder has the ocijdbc11.dll file. I have tried copying the file to /lib as well but I am getting the same error.


Solution

  • I encountered this problem. First go to oracle download 'instantclient' instantclient download

    unzip------Believe you have copied the ojdbc.jar and xtream.jar to kafka lib.

    Then Adding environment variables

    vim /etc/profile

    add:

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

    save----wq!

    ohhhhhh, remember --- resoure /etc/profile

    run again