Support Questions
Find answers, ask questions, and share your expertise

org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

New Contributor

Hi,

I installed HDP 2.4.2.0-258 on cluster of 7 nodes using ambari-2.2.2.0 on Google cloud machines.

(In this cluster Hive and Hbase are on different hosts) .

In our java program, when we want to create an external table in Hive, we get the following error:

org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

Does any one know, what could be the reason of this issue?

Thanks,

David

4 REPLIES 4

Re: org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

@David M

you need to execute this command on shell prompt before you run java -cp

bash# export HADOOP_CLASSPATH=$HADOOP_CLASSPATH:/path/hbase<version>.jar

bash# export CLASSPATH=$CLASSPATH:$HADOOP_CLASSPATH

and then launch java as java -cp $HADOOP_CLASSPATH <java>

Re: org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

New Contributor

@Sindhu

The same issue happens when we manually want to create external table in Hive view in Ambari:

For example:

create external table PRODUCTS(key string, 
PRODUCT_ID DOUBLE, PRODUCT_NAME STRING, LIST_PRICE DOUBLE, 
PRODUCT_SIZE STRING, CATALOG_URL STRING, PRODUCT_DESCRIPTION STRING, 
LAST_UPDATE STRING) 
stored by 'org.apache.hadoop.hive.hbase.HBaseStorageHandler' with serdeproperties ('hbase.columns.mapping' = ':key,PRODUCTS:PRODUCT_ID#b,PRODUCTS:PRODUCT_NAME,PRODUCTS:LIST_PRICE#b,PRODUCTS:PRODUCT_SIZE,PRODUCTS:CATALOG_URL,PRODUCTS:PRODUCT_DESCRIPTION,PRODUCTS:LAST_UPDATE') tblproperties ('hbase.table.name' = 'default:PRODUCTS')

The error:

org.apache.ambari.view.hive.client.HiveErrorStatusException: H110 Unable to submit statement. java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection [ERROR_STATUS]

org.apache.ambari.view.hive.client.HiveErrorStatusException: H110 Unable to submit statement. java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection [ERROR_STATUS]
	at org.apache.ambari.view.hive.client.Utils.verifySuccess(Utils.java:48)
	at org.apache.ambari.view.hive.client.Connection.execute(Connection.java:614)
	at org.apache.ambari.view.hive.client.Connection.executeAsync(Connection.java:625)
	at org.apache.ambari.view.hive.resources.jobs.ConnectionController.executeQuery(ConnectionController.java:67)
	at org.apache.ambari.view.hive.resources.jobs.viewJobs.JobControllerImpl.submit(JobControllerImpl.java:109)
	at org.apache.ambari.view.hive.resources.jobs.JobService.create(JobService.java:431)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
	at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
	at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)

Re: org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

@David M

Try adding the jar before running the query as:

add /usr/hdp/<version>/hbase/lib/hbase-client-1.1.2.2.4.0.0-169.jar;

Then run the query and try.

Re: org.apache.hive.service.cli.HiveSQLException: java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/client/Connection

Contributor

To resolve this permanently you might also want to add /usr/hdp/<version>/hbase/lib/hbase-client-1.1.2.2.4.0.0-169.jar to templeton.libjars or /usr/hdp/<version>/hbase/lib to templeton.hive.extra.files in webhcat-site.xml

There are a few other places that you might make the adjustment depending on your runtime needs. I think, though, that the hive view in ambari uses the templeton endpoint.