hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Capriolo <edlinuxg...@gmail.com>
Subject Re: Running Hive JDBC get ClassNotFound: org.apache.hadoop.conf.Configuration
Date Sat, 14 Jun 2014 12:51:04 GMT
The way the hive components are packaged they do not bring many transative
dependencies. You need to bring those in, potentially using the
<scope>provided</scope>. That stack trace shows that hadoop components are
not on the classpath.

To start you are going to need:

		<dependency>
			<groupId>org.apache.hadoop</groupId>
			<artifactId>hadoop-core</artifactId>
			<version>1.2.1</version>
  <scope>provided</scope>
		</dependency>



An example is here.

https://github.com/edwardcapriolo/hive_test/blob/master/pom.xml


On Fri, Jun 13, 2014 at 11:49 PM, Néstor Boscán <nestorjb@gmail.com> wrote:

> Hi
>
> I recently downloaded the HDP 2.1 Sandbox. I'm trying to create a simple
> java program that connects to the hive server. I'm using maven with the
> following dependency:
>
>         <dependency>
>             <groupId>org.apache.hive</groupId>
>             <artifactId>hive-jdbc</artifactId>
>             <version>0.13.1</version>
>         </dependency>
>
> Here is the java program:
>
> public class PruebaHive {
>     public PruebaHive() {
>     }
>
>     public static void main(String[] args) throws Exception {
>         Class.forName("org.apache.hive.jdbc.HiveDriver");
>         Connection connection = DriverManager.getConnection("jdbc:hive2://
> 192.168.182.128:10000", "", "");
>
>         connection.close();
>     }
> }
>
> But I'm getting the following exception:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/hadoop/conf/Configuration
>  at
> org.apache.hive.jdbc.HiveConnection.createBinaryTransport(HiveConnection.java:367)
> at
> org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:200)
>  at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:178)
> at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
>  at java.sql.DriverManager.getConnection(DriverManager.java:582)
> at java.sql.DriverManager.getConnection(DriverManager.java:185)
>  at ve.com.pacific.buscador.PruebaHive.main(PruebaHive.java:18)
> Caused by: java.lang.ClassNotFoundException:
> org.apache.hadoop.conf.Configuration
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>  at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> Regards,
>
> Néstor
>

Mime
View raw message