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

RStudio & Hive Connectivity Issue

My Error

=======

INFO: Resolved authority: <hostname>:10000
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
  java.lang.NoClassDefFoundError: Could not initialize class org.apache.hive.service.auth.HiveAuthFactory

=====

Here is my connectivity details in R Studio in Windows 7 connecting to Remote Hadoop Server.

#loading libraries

library(rJava)
library(RJDBC)
library(DBI)

#init of the classpath (works with hadoop 2.6 on CDH 5.4 installation)
cp = c("C:/R/java/hive-jdbc.jar", "C:/R/java/hadoop-common.jar", "C:/R/java/hadoop-client-2.5.1.jar", "C:/R/java/commons-logging-commons-logging.jar","C:/R/java/libthrift-0.9.2.jar", "C:/R/java/hive-service.jar", "C:/R/java/httpclient-4.2.5.jar", "C:/R/java/httpcore-4.2.5.jar", "C:/R/java/hive-jdbc-1.2.1000.2.6.1.39-2.jar")
.jinit(classpath=cp)
.jclassLoader()$setDebug(1L)

#init of the connexion to Hive server
drv <- JDBC("org.apache.hive.jdbc.HiveDriver", "c:/R/java/hive-jdbc-2.0.0.jar", identifier.quote="`")
conn <- dbConnect(drv, "jdbc:hive2://xxxxxx:10000/raw_irf;","hive","")

My output in the console

> #loading libraries
> > library(rJava)
> library(RJDBC)
> library(DBI)
> > #init of the classpath (works with hadoop 2.6 on CDH 5.4 installation)
> cp = c("C:/R/java/hive-jdbc.jar", "C:/R/java/hadoop-common.jar", "C:/R/java/hadoop-client-2.5.1.jar",  "C:/R/java/commons-logging-commons-logging.jar","C:/R/java/libthrift-0.9.2.jar", "C:/R/java/hive-service.jar", "C:/R/java/httpclient-4.2.5.jar", "C:/R/java/httpcore-4.2.5.jar", "C:/R/java/hive-jdbc-1.2.1000.2.6.1.39-2.jar")
> .jinit(classpath=cp)
RJavaClassLoader: added 'C:/R/java/hive-jdbc.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/hive-jdbc.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/hadoop-common.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/hadoop-common.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/hadoop-client-2.5.1.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/hadoop-client-2.5.1.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/commons-logging-commons-logging.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/commons-logging-commons-logging.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/libthrift-0.9.2.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/libthrift-0.9.2.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/hive-service.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/hive-service.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/httpclient-4.2.5.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/httpclient-4.2.5.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/httpcore-4.2.5.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/httpcore-4.2.5.jar' to the internal class path
RJavaClassLoader: added 'C:/R/java/hive-jdbc-1.2.1000.2.6.1.39-2.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/R/java/hive-jdbc-1.2.1000.2.6.1.39-2.jar' to the internal class path
[1] 0
> .jclassLoader()$setDebug(1L)
> > #init of the connexion to Hive server
> drv <- JDBC("org.apache.hive.jdbc.HiveDriver", "c:/R/java/hive-jdbc-2.0.0.jar", identifier.quote="`")
RJavaClassLoader: added 'c:/R/java/hive-jdbc-2.0.0.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'c:/R/java/hive-jdbc-2.0.0.jar' to the internal class path
RJavaClassLoader: added 'C:/Users/sdrav01/AppData/Local/Continuum/Anaconda2/envs/rstudio/R/library/RJDBC/java/RJDBC.jar' to the URL class path loader
RJavaClassLoader: adding Java archive file 'C:/Users/sdrav01/AppData/Local/Continuum/Anaconda2/envs/rstudio/R/library/RJDBC/java/RJDBC.jar' to the internal class path
> conn <- dbConnect(drv, "jdbc:hive2://ucschdpprd03.steelroads.com:10000/raw_irf;","hive","")
Jan 04, 2018 12:15:25 AM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: ucschdpprd03.steelroads.com:10000
Jan 04, 2018 12:15:25 AM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: ucschdpprd03.steelroads.com:10000
Jan 04, 2018 12:15:25 AM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: ucschdpprd03.steelroads.com:10000
Jan 04, 2018 12:15:25 AM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: <hostname>:10000
Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", as.character(url)[1],  : 
  java.lang.NoClassDefFoundError: Could not initialize class org.apache.hive.service.auth.HiveAuthFactory

I tried to search in google and tried so many different things for 2 days. Still having the same error

1 REPLY 1

Any help is appreciated. I know some folks have experienced this before. But I tired all the suggestions and still facing issue

; ;