nexr / RHive

RHive is an R extension facilitating distributed computing via Apache Hive.
http://nexr.github.io/RHive
122 stars 63 forks source link

rhive.connect() -> Exception in thread java.lang.RuntimeException: java.sql.SQLException: java.lang.ClassNotFoundException #93

Closed Worvast closed 8 years ago

Worvast commented 8 years ago

I, we configure all (apparently) correct and we receive the next error when run

Sys.setenv(HADOOP_CMD="/opt/cloudera/parcels/CDH-5.4.5-1.cdh5.4.5.p0.7/bin/hadoop")
Sys.setenv(RHIVE_HIVESERVER_VERSION="2");
library("rJava", lib.loc="/usr/lib64/R/library")
library("RJDBC", lib.loc="/usr/lib64/R/library")
library("rhdfs", lib.loc="/usr/lib64/R/library")
hdfs.init()
library("Rserve", lib.loc="~/R/x86_64-redhat-linux-gnu-library/3.2")
library("RHive", lib.loc="~/R/x86_64-redhat-linux-gnu-library/3.2")
rhive.init()

rhive.connect(host="oururl",port="ourport", defaultFS="hdfs://ourhdfsservice", hiveServer2=TRUE ,updateJar=FALSE)

(I want to say HIVE_HOME and HADOOP_HOME are correctly defined)

The error we receive:

Exception in thread "Thread-12" java.lang.RuntimeException: java.sql.SQLException: java.lang.ClassNotFoundException
    at com.nexr.rhive.hive.HiveJdbcClient$HiveJdbcConnector.connect(HiveJdbcClient.java:337)
    at com.nexr.rhive.hive.HiveJdbcClient$HiveJdbcConnector.run(HiveJdbcClient.java:322)
Caused by: java.sql.SQLException: java.lang.ClassNotFoundException
    at com.nexr.rhive.hive.DatabaseConnection.connect(DatabaseConnection.java:41)
    at com.nexr.rhive.hive.HiveJdbcClient$HiveJdbcConnector.connect(HiveJdbcClient.java:330)
    ... 1 more
Caused by: java.lang.ClassNotFoundException
    at RJavaClassLoader.findClass(RJavaClassLoader.java:383)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:191)
    at com.nexr.rhive.hive.DatabaseConnection.connect(DatabaseConnection.java:38)
    ... 2 more
Error: java.lang.IllegalStateException: Not connected to hiveserver

What happens here? We try to reinstall Hive but same error.

ghost commented 8 years ago

Hi @Worvast I think RHIVE_HIVESERVER_VERSION is missing. It should have value of 2. Try to set this env val before connect.

Sys.setenv(RHIVE_HIVESERVER_VERSION="2")

Thanks.

Worvast commented 8 years ago

Hi @DrakeMin, thanks you for the answer but i get the same error with the HiveServer version setted, not changes :(

I edit the question and add the step you suggest for secure all its tested.

ghost commented 8 years ago

@Worvast Ok, then double check your HIVE_HOME. There must be hive-jdbc-*.jar in the ${HIVE_HOME}/lib dir. This jar has the JDBC driver class org.apache.hive.jdbc.HiveDriver we need.

Thanks.

Worvast commented 8 years ago

Thanks you for all, finally i found the problem happend because HIVE_HOME are misconfigured permissions and the user could not use the files, (wtf!).

Sorry for all, i close the issue and thanks you for the help, almost i learn a lot about R Packages and Hive xD