无法加载 jdbc 驱动程序类 PostgreSQL + NIFI



开始与Nifi一起工作,这是我的第一个练习。

因此,试图将CSV文件放在Postgres表中。我定义了数据库驱动程序,如图所示。

错误是:

无法加载JDBC驱动程序类

在我的日志文件中,我有此消息:

ERROR [StandardProcessScheduler Thread-1] o.a.n.c.s.StandardControllerServiceNode DBCPConnectionPool[id=c25f8f91-0161-1000-a496-8910832bdbd8] F$
org.apache.nifi.reporting.InitializationException: Can't load Database Driver
        at org.apache.nifi.dbcp.DBCPConnectionPool.getDriverClassLoader(DBCPConnectionPool.java:249)
        at org.apache.nifi.dbcp.DBCPConnectionPool.onConfigured(DBCPConnectionPool.java:198)
        at sun.reflect.GeneratedMethodAccessor437.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:137)
        at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125)
        at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70)
        at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotation(ReflectionUtils.java:47)
        at org.apache.nifi.controller.service.StandardControllerServiceNode$2.run(StandardControllerServiceNode.java:409)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        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.lang.ClassNotFoundException: org.postgresql.Driver

Postgres JDBC驱动程序未与Nifi打包。你必须

  1. 下载驱动程序(JAR(,例如 PostgreSQL-42.2.24.jar
  2. 将其放入 NIFI/LIB 文件夹
  3. 重新启动 nifi
  4. 打开您的 dbcpconnectionpool 控制器服务属性
  5. set 数据库驱动程序类名称 to org.postgresql.driver

资源

  • https://jdbc.postgresql.org/download.html
  • https://docs.oracle.com/cd/e19509-01/820-3497/agqka/index.html
  • .html

问答者找到了根本原因:我在JDBC名称

之后将返回插入。

最新更新