Hi All,

Request your help.

We are trying to connect to hive from R using Rstudio. Its a kerberos secured 
cluster. Code snippet is below.

==============

library(rJava)
library(RJDBC)

cp = 
c("/usr/hdp/2.3.2.0-2950/hive/lib/hive-jdbc.jar","/usr/hdp/2.3.2.0-2950/hadoop/lib/hadoop-common-2.7.1.2.3.2.0-2950.jar")
.jinit(classpath=cp)

drv <- JDBC("org.apache.hive.jdbc.HiveDriver",classPath = 
list.files("/usr/hdp/2.3.2.0-2950/hadoop/lib",pattern="jar$",full.names=T, 
recursive = TRUE),identifier.quote="`")

conn <- dbConnect(drv, 
"jdbc:hive2://host.node1.com:10000/default;principal=hive/shost.node1....@node1.com<mailto:shost.node1....@node1.com>",
 "", "")

show_databases <- dbGetQuery(conn, "show databases")

show_databases

==============

But we are getting the below error

Error in .jcall(drv@jdrv, "Ljava/sql/Connection;", "connect", 
as.character(url)[1],  :
  java.lang.NoClassDefFoundError: Could not initialize class 
org.apache.hadoop.security.UserGroupInformation

What are we missing here? A kerberos ticket is there in place. Shall we 
usekerberos  keytab inside R code? What is the function for ir. Also which 
hadoop libraries should we import for R and hive interaction?



Thanks & Regards,

Anoop Kumar K M

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to