使用ExecuteSQL时,NiFi DBCPConnectionPool抛出NoClassDefFoundError

时间:2017-11-23 09:02:32

标签: jdbc apache-nifi impala

我使用DBCPConnectionPool通过JDBC连接到impala。

我已经指出了一个文件夹,其中包含来自Cloudera的Impala JDBC驱动程序及其所有依赖项。我已将驱动程序类名称设置为:

  

com.cloudera.impala.jdbc4.Driver

连接URL看起来像这样:

  

JDBC:帕拉://服务器:端口/默认值; AuthMech = 0;

启用Controller Service不会导致错误,但是当我启用ExecuteSQL时会抛出异常:

  由于java.lang.NoClassDefFoundError,

无法处理会话:无法初始化类com.cloudera.impala.core.ImpalaJDBCDriver:无法初始化类com.cloudera.impala.core.ImpalaJDBCDriver

有什么想法吗?

编辑:

当我更新驱动程序时,我收到了一个不同的例外: Unable to execute query select * from table_name limit 1; due to org.apache.nifi.processor.exception.ProcessException: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.cloudera.impala.jdbc41.Driver' for connect URL 'jdbc:impala://server:port/db;AuthMech=0;'. No FlowFile to route to failure: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.cloudera.impala.jdbc41.Driver' for connect URL 'jdbc:impala://server:port/db;AuthMech=0;'.

堆栈跟踪: 来自nifi-app.log:

  

java.lang.NoClassDefFoundError: Could not initialize class com.cloudera.impala.core.ImpalaJDBCDriver
 at java.lang.Classs.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.cloudera.dsi.core.impl.DSIDriverFactory.createDriver(Unknown Source)
at com.cloudera.jdbc.common.AbstractDriver.doInitialize(Unknown Source)
at com.cloudera.jdbc.common.AbstractDriver.connect(Unknown Source)
at org.apache.nifi.dbcp.DriverShim.connect(DriverShim.java:46)
at org.apache.commons.dbcpDriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory:1556)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.comons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
at org.apache.nifi.dbcp.DBCPConnectionPool.getConnection(DBCPConnectionPool.java:272)
at sun.reflect.Method.invoke(Method.java:498)
at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler:89)
at com.sun.proxy.$Proxy453.getConnection(Unknown Source)
at org.apache.nifi.processors.standarad.ExecuteSQL.onTrigger(ExecuteSQL.java:199)
at org.apache.nifi.processor.AbsractProcessor.onTrigger(AbstractProcessor.java:27)
at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1119)
at org.apache.nifi.controller.tasks.ContinuallyRunPRocessorTask.call(ContinuallyRunProcessorTask.java:147)
org.apache.nifi.controller.tasks.ContinuallyRunPRocessorTask.call(ContinuallyRunProcessorTask.java:47)
at or.apache.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:128)
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:1142)
at java.util.concurrent.ThreadPool.Executor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:1)

重新启动服务器后,它突然工作了。真奇怪。不管怎样,谢谢!