File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Hadoop and the fly likes Hive Connectivity using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Hadoop
Bookmark "Hive Connectivity using java" Watch "Hive Connectivity using java" New topic

Hive Connectivity using java

syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Hi All,

Im trying to query hive database using java JDBC.I followed the same steps which mentioned in the apache wiki,
if i try to execute the code it throws me class not found exception.

Even i have included the following jars in my classpath.


hive-shims-0.10.0-cdh4.5.0.jar has org/apache/hadoop/hive/shims/ShimLoader class in it.

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hive/shims/ShimLoader
at org.apache.hive.service.auth.KerberosSaslHelper.getKerberosTransport(
at org.apache.hive.jdbc.HiveConnection.openTransport(
at org.apache.hive.jdbc.HiveConnection.<init>(
at org.apache.hive.jdbc.HiveDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at Source)
at Source)
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.shims.ShimLoader
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(

Please suggest me how to solve this

Thanks in advance

All search starts with beginner's luck and all search ends with victor's severly tested.
Rajesh Nagaraju
Ranch Hand

Joined: Nov 27, 2003
Posts: 57
hive should be run as a server
syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 93
Hi Rajesh,

can you please elaborate this ?

Thanks a lot for your response
Rajesh Nagaraju
Ranch Hand

Joined: Nov 27, 2003
Posts: 57
Sorry I had not checked for some time

hive should be run as a server -- means that when we run it as a server, it runs the thrift service which enables us to connect through Java
robbie feng

Joined: Jul 29, 2014
Posts: 1
I think you need some hadoop common libs for hive is base on hadoop
Don't get me started about those stupid light bulbs.
subject: Hive Connectivity using java
Similar Threads
it is urgent..please help me some one
Running java with a classpath on cygwin
Access DB Connect Issues
jar error