Bishal
Bishal

Reputation: 63

Nifi 1.11.3 Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver'

I am trying to connect Nifi 1.11.3 on one server, to Oracle Express Edition 18c on another remote server.

I am using processor ExecuteSQL.

I have tried the follows steps till now to resolve the error:

  1. added the ojdbc8.jar file under /lib and restarted nifi services.
  2. under Database Driver Location setting, I have added the exact driver name, but same error.
  3. checked connection to DB from sqlplus using username/password@//:1521/servicename, and it connects to DB.

The DBCPConnectionPool settings are as follows:

enter image description here

The nifi-app.log is as follows:

2020-03-12 15:09:55,031 INFO [Flow Service Tasks Thread-1] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController@498c52f9 // Another save pending = false
2020-03-12 15:09:55,758 ERROR [Timer-Driven Process Thread-7] o.a.nifi.processors.standard.ExecuteSQL ExecuteSQL[id=c86ad1a5-0170-1000-d62b-9bdd35868a4c] Unable to execute SQL select query select * from customers due to org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@//server_url:1521/XEPDB1'. No FlowFile to route to failure: org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@//server_url:1521/XEPDB1'
org.apache.nifi.processor.exception.ProcessException: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@//server_url:1521/XEPDB1'
        at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:444)
        at org.apache.nifi.dbcp.DBCPService.getConnection(DBCPService.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:87)
        at com.sun.proxy.$Proxy91.getConnection(Unknown Source)
        at org.apache.nifi.processors.standard.AbstractExecuteSQL.onTrigger(AbstractExecuteSQL.java:236)
        at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
        at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1176)
        at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:213)
        at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:117)
        at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URL 'jdbc:oracle:thin@//server_url:1521/XEPDB1'
        at org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:75)
        at org.apache.commons.dbcp2.BasicDataSource.createConnectionFactory(BasicDataSource.java:472)
        at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:538)
        at org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:753)
        at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:440)
        ... 20 common frames omitted
Caused by: java.sql.SQLException: No suitable driver
        at org.apache.commons.dbcp2.DriverFactory.createDriver(DriverFactory.java:68)
        ... 24 common frames omitted
2020-03-12 15:09:55,758 DEBUG [Timer-Driven Process Thread-7] o.a.nifi.processors.standard.ExecuteSQL ExecuteSQL[id=c86ad1a5-0170-1000-d62b-9bdd35868a4c] has chosen to yield its resources; will not be scheduled to run again for 1000 milliseconds
2020-03-12 15:09:56,172 INFO [NiFi Web Server-22] o.a.n.c.s.StandardProcessScheduler Stopping ExecuteSQL[id=c86ad1a5-0170-1000-d62b-9bdd35868a4c]
2020-03-12 15:09:56,172 INFO [NiFi Web Server-22] o.a.n.controller.StandardProcessorNode Stopping processor: ExecuteSQL[id=c86ad1a5-0170-1000-d62b-9bdd35868a4c]
2020-03-12 15:09:56,176 INFO [Timer-Driven Process Thread-3] o.a.n.c.s.TimerDrivenSchedulingAgent Stopped scheduling ExecuteSQL[id=c86ad1a5-0170-1000-d62b-9bdd35868a4c] to run
2020-03-12 15:09:56,551 INFO [Flow Service Tasks Thread-1] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController@498c52f9 // Another save pending = false
2020-03-12 15:10:05,963 INFO [Write-Ahead Local State Provider Maintenance] org.wali.MinimalLockingWriteAheadLog org.wali.MinimalLockingWriteAheadLog@738b93a8 checkpointed with 1 Records and 0 Swap Files in 14 milliseconds (Stop-the-world time = 4 milliseconds, Clear Edit Logs time = 5 millis), max Transaction ID 6

Please let me know where am I going wrong.

Regards, Bishal

Upvotes: 1

Views: 2420

Answers (1)

Bishal
Bishal

Reputation: 63

Found the problem ! I was missing a ":" after thin.

I was using jdbc:oracle:thin@, it should be jdbc:oracle:thin:@

A very silly mistake on my end !

Upvotes: 1

Related Questions