ProfessionSDET
ProfessionSDET

Reputation: 1

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

can anyone please help me how to resolve the below issue. code snippet is below.

try {
            Class.forName("org.apache.hive.jdbc.HiveDriver");
            Connection con = DriverManager.getConnection("jdbc:hive2://host:port", "user", "nc_admin");
            System.out.println(con);
            Statement stmt = con.createStatement();
            System.out.println(stmt);
        } catch (ClassNotFoundException e) {

            e.printStackTrace();
        } catch (SQLException e) {

            e.printStackTrace();
        }
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient

Upvotes: 0

Views: 506

Answers (1)

Anirudh Jadhav
Anirudh Jadhav

Reputation: 1007

If it's a maven project use this pom.

<!-- https://mvnrepository.com/artifact/org.apache.hive/hive-jdbc -->
<dependency>
    <groupId>org.apache.hive</groupId>
    <artifactId>hive-jdbc</artifactId>
    <version>3.1.2</version>
</dependency>

or download the jar from here

hive driver

Upvotes: 0

Related Questions