Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

NiFi 1.19.1 with JAVA 11 fails to start a DBCP Connection Pool

avatar

So guys,

Need your help with something with which I have been struggling in the last couple of days. I just installed a NiFi cluster, composed of 5 machines. I have used NiFI 1.19.1 as it is the latest version.

Now, when trying to create a DBCP Connection Pool, I keep on receiving the below error messages. Beside these two, I receive plenty more with other classes. Right now, I am using "openjdk version "11.0.8" 2020-07-14 LTS" so thereafter I have uploaded ojdbc11.jar in my lib folder, on all servers. Afterwards I have restarted each server and tried to create a new DBCP Connection Pool, but kept on receiving the these error messages.
Database Connection URL = jdbc:oracle:thin:@HOSTNAME:PORT/SERVICE
Database Driver Class Name = oracle.jdbc.driver.OracleDriver
Database Driver Location(s) = /opt/nifi-1.19.1/lib/ojdbc11.jar

Do you know what might be the cause of this problem? On a cluster of servers with java 8 I do not encounter such issues.


2023-01-27 18:00:08,841 ERROR [Timer-Driven Process Thread-78] o.a.n.c.s.StandardControllerServiceNode StandardControllerServiceNode[service=DBCPConnectionPool[id=d3031de0-b6a9-311c-beef-d0d9bcb59605], name=[PROD] PostgreSQL DB Connection, active=true] Failed to invoke @OnEnabled method
java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.dbcp2.BasicDataSource
at org.apache.nifi.dbcp.AbstractDBCPConnectionPool.onConfigured(AbstractDBCPConnectionPool.java:389)
at jdk.internal.reflect.GeneratedMethodAccessor611.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:145)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:133)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:78)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:55)
at org.apache.nifi.controller.service.StandardControllerServiceNode$2.run(StandardControllerServiceNode.java:598)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
2023-01-27 18:01:11,997 ERROR [Timer-Driven Process Thread-50] o.a.n.c.s.StandardControllerServiceNode StandardControllerServiceNode[service=DBCPConnectionPool[id=f3f22e9b-0185-1000-ffff-ffffed3b34e0], name=DBCPConnectionPool, active=true] Failed to invoke @OnEnabled method
java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.OracleDriver
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:555)
at java.sql/java.sql.DriverManager.isDriverAllowed(DriverManager.java:547)
at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:449)
at java.sql/java.sql.DriverManager.getDrivers(DriverManager.java:426)
at org.apache.commons.dbcp2.BasicDataSource.<clinit>(BasicDataSource.java:73)
at org.apache.nifi.dbcp.AbstractDBCPConnectionPool.onConfigured(AbstractDBCPConnectionPool.java:389)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:145)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:133)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:78)
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:55)
at org.apache.nifi.controller.service.StandardControllerServiceNode$2.run(StandardControllerServiceNode.java:598)
at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

1 REPLY 1

avatar

I was able to identify and solve my problem eventually. It seems that I had an invalid JAR file in the library folder. What I did was to sequentially remove all the "not default" jar files, one by one, restart NiFi after each iteration and eventually I identified the faulty JAR File. Afterwards, I copied all my other JAR Files back into the lib folder, restarted NiFi and that is all, NiFi started without any further issues.