Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
06-30-2017
01:41 PM
- last edited on
04-21-2026
06:28 AM
by
GrazittiAPI
I am trying to access Hive tables from R by using JDBC, but it's failing while establishing the connection for
org.apache.hadoop.security.UserGroupInformation
I thought "hadoop-core.jar" would provide this class, but it's still failing.
Does someone have any idea?
library("DBI")
library("rJava")
library("RJDBC")
cp = c("/home/cdsw/impala_jars/hadoop-common.jar", "/home/cdsw/hive_jars/libthrift-0.9.0.jar",
"/home/cdsw/hive_jars/hive_service.jar", "/home/cdsw/hive_jars/hadoop-core.jar",
"/home/cdsw/hive_jars/TCLIServiceClient.jar", "hive_jars/hive-jdbc-1.1.0-cdh5.10.1-standalone.jar")
.jinit(classpath=cp)
for(l in list.files('/home/cdsw/hive_jars')){ .jaddClassPath(paste("/home/cdsw/hive_jars",l,sep=""))}
for(l in list.files('/home/cdsw/impala_jars')){ .jaddClassPath(paste("/home/cdsw/impala_jars",l,sep=""))}
.jclassPath()
drv <- JDBC("org.apache.hive.jdbc.HiveDriver", "hive_jars/hive-jdbc-1.1.0-cdh5.10.1-standalone.jar", identifier.quote="`")
con <- dbConnect(drv, "jdbc:hive2://localhost:10000/default;principal=hive/{HOST}@{REALM}")
Created 07-06-2017 09:57 AM
Hi Everyone,
Not sure if anyone else faced this issue, but after much research I was able to connect to Kerberized Hive successfully.
I appended "-Djavax.security.auth.useSubjectCredsOnly=false" to the "jinit"
.jinit(classpath=cp, parameters="-Djavax.security.auth.useSubjectCredsOnly=false")
Basically, it disables the requirement of a GSS mechanism to obtain necessary credentials from an existing Subject and allows to use the specified authentication mechanism, which in this case is Kerberos.
Created 06-30-2017 02:55 PM
Here's an update:
I was able to fix the initial issue by adding all the jars in /opt/cloudera/parcels/CDH/... directory.
However, now it's failing with Kerberos TGT not found error, although I am doing kinit before connecting.
Is there something I am missing?
"
javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]
"
Created 07-06-2017 09:57 AM
Hi Everyone,
Not sure if anyone else faced this issue, but after much research I was able to connect to Kerberized Hive successfully.
I appended "-Djavax.security.auth.useSubjectCredsOnly=false" to the "jinit"
.jinit(classpath=cp, parameters="-Djavax.security.auth.useSubjectCredsOnly=false")
Basically, it disables the requirement of a GSS mechanism to obtain necessary credentials from an existing Subject and allows to use the specified authentication mechanism, which in this case is Kerberos.