jdbc通过rdbc包连接到hiveversion0.14.0和r

1hdlvixo  于 2021-05-29  发布在  Hadoop
关注(0)|答案(0)|浏览(266)

我让hiveserver在一台机器上运行1
下面是我用于jdbc连接的代码

hive_jars <- list.files("/home/jar/hive_jdbc_jar/", 
               pattern = "[.]jar", full.names=FALSE, recursive=TRUE)

lib_dir <- "/home/jar/hive_jdbc_jar/"

hive_class_path <- sprintf( '%s/%s', lib_dir, hive_jars )

.jinit(classpath=hive_class_path, parameters="-DrJava.debug=true")

hostname <- "10.140.224.64"
port <- "10000"
drv <- JDBC( 'org.apache.hadoop.hive.jdbc.HiveDriver',  classPath= hive_class_path, "`" )
server <- sprintf( 'jdbc:hive://%s:%s/default', hostname, port )
hiveconnection <- dbConnect( drv, server )

我犯了个错误

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

我加的jar

"antlr-2.7.7.jar" 
  "antlr-runtime-3.4.jar"           "commons-logging-1.1.3.jar"      
  "derby-10.10.1.1.jar"             "hadoop-common-2.4.1.jar"         "hive-exec-0.14.0.jar"           
 "hive-jdbc-0.14.0-standalone.jar" "hive-jdbc-0.14.0.jar"            "hive-metastore-0.14.0.jar"      
"hive-service-0.14.0.jar"         "jdo-api-3.0.1.jar"               "libfb303-0.9.0.jar"             
"libthrift-0.9.0.jar"             "log4j-1.2.16.jar"                "slf4j-api-1.7.5.jar"            
"slf4j-log4j12-1.7.5.jar"

https://cwiki.apache.org/confluence/display/hive/hiveclient

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题