Community Articles
Find and share helpful community-sourced technical articles

When running a custom Java application that connects via JDBC to Hive, after migration to HDP-2.6.x, the application now fails to start with a NoClassDefFoundError or ClassNotFoundException related to a Hive class, like:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hive/service/cli/thrift/TCLIService$Iface
at org.apache.hive.jdbc.HiveDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(

Root Cause

Prior to HDP-2.6.x, the hive-jdbc.jar is a symlink which points to the "standalone" jdbc jar (the one intended to be used for non-hadoop apps, like a generic app that has JDBC driver DB accessibility), for example in HDP 2.5.0:

/usr/hdp/current/hive-client/lib/hive-jdbc.jar -> hive-jdbc-1.2.1000.

But from newer versions, HDP-2.6.x onwards, the hive-jdbc.jar now points to the "hadoop env" JDBC driver, which has dependencies on many other Hadoop JARs, for example in HDP 2.6.2:

/usr/hdp/current/hive-client/lib/hive-jdbc.jar -> hive-jdbc-1.2.1000. 

or in HDP-2.6.3

/usr/hdp/current/hive-client/lib/hive-jdbc.jar -> hive-jdbc-1.2.1000.

Does this mean the HDP stack no longer includes a standalone JAR ? No.

The standalone jar has been moved to this path:


Two ways to solve this:

1. Change the custom Java application's classpath to use the hive-jdbc-*-standalone.jar explicitly

As noted above, the standalone jar is now available in a different path.

For example in HDP-2.6.2:


In HDP-2.6.3


2. Add the following to the HADOOP_CLASSPATH of the custom Java application if it uses other Hadoop components/JARs