使用NoClassDefFoundError Hive Jdbc连接错误

时间:2017-07-04 07:05:55

标签: java hadoop jdbc hive

我正在编写Jdbc程序来连接hive数据库但是 我收到的错误是:

  

线程“main”中的异常java.lang.NoClassDefFoundError:   org / apache / hadoop / conf /配置在   org.apache.hive.jdbc.HiveConnection.createUnderlyingTransport(HiveConnection.java:418)     在   org.apache.hive.jdbc.HiveConnection.createBinaryTransport(HiveConnection.java:438)     在   org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:225)     在   org.apache.hive.jdbc.HiveConnection。(HiveConnection.java:182)     在org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107)at   java.sql.DriverManager.getConnection(DriverManager.java:571)at   java.sql.DriverManager.getConnection(DriverManager.java:215)at   com.nucsoft.client.HiveJdbc.main(HiveJdbc.java:31)

1 个答案:

答案 0 :(得分:0)

您错过了Configuration课程。 Hadoop 2中的hadoop-core jar已更改为hadoop-common。这里是依赖项a link to download the JAR

<dependency>
    <groupId>org.apache.hadoop</groupId>
    <artifactId>hadoop-common</artifactId>
    <version>2.7.3</version>
</dependency>