java.lang.classnotfoundexception将配置单元连接到r时出错

svmlkihl  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(459)

下面是我尝试的代码,但有一个错误,请让我知道我哪里出错了。

library("RJDBC") 
    .jinit()
    .jaddClassPath("/home/r_work/hive_service.jar")
    .jaddClassPath("/home/r_work/HiveJDBC4.jar")
    .jaddClassPath("/home/r_work/libfb303-0.9.0.jar")
    .jaddClassPath("/home/r_work/libthrift-0.9.0.jar")
    .jaddClassPath("/home/r_work/log4j-1.2.14.jar")
    .jaddClassPath("/home/r_work/hive_metastore.jar")
    .jaddClassPath("/home/r_work/ql.jar")
    .jaddClassPath("/home/r_work/slf4j-api-1.5.8.jar")
    .jaddClassPath("/home/r_work/slf4j-log4j12-1.5.8.jar")
    .jaddClassPath("/home/r_work/TCLIServiceClient.jar")
    .jclassPath()

    drv = JDBC("com.cloudera.hive.jdbc4.HS2Driver","~/r_work/hive_service.jar;~/r_work/HiveJDBC4.jar;~/r_work/libfb303-0.9.0.jar;~/r_work/libthrift-0.9.0.jar;~/r_work/log4j-1.2.14.jar;~/r_work/hive_metastore.jar;~/r_work/ql.jar;~/r_work/slf4j-api-1.5.8.jar;~/r_work/slf4j-log4j12-1.5.8.jar;~/r_work/TCLIServiceClient.jar","`")

    #drv = JDBC("com.cloudera.hive.jdbc4.HS2Driver","~/r_work/HiveJDBC4.jar","`")

    conn <- dbConnect(drv, "jdbc:hive2://grbd.com:10000/test_hive_db;AuthMech=1;KrbRealm=INTRANET.BARCAPINT.COM;KrbHostFQDN=grbd.com;KrbServicename=hive")

    #conn <- dbConnect(drv, "jdbc:hive2://grbdwhd0017.intranet.barcapint.com:10000;AuthMech=1;KrbRealm=INTRANET.BARCAPINT.COM;KrbHostFQDN=grbdwhd0017.intranet.barcapint.com;KrbServicename=hive")

     library(RHive)
    >  Sys.setenv(HIVE_Home= "ls /cloudera/parcels/lib/hive")
    >  Sys.setenv(HIVE_Lib= "ls /cloudera/parcels/lib/hive/lib")
    >  Sys.setenv(HIVE_HOME= "ls /cloudera/parcels/lib/hive")
    >  Sys.setenv(HIVE_LIB= "ls /cloudera/parcels/lib/hive/lib")
    >  Sys.setenv(HADOOP_HOME= "ls /cloudera/parcels/lib/hadoop")
    >  Sys.setenv(HADOOP_CONF = "ls /cloudera/parcels/lib/hadoop/etc/hadoop/hdfs-site.xml")
    >  Sys.setenv(HADOOP_LIB= "ls /cloudera/parcels/lib/hadoop/lib")
     rhive.init()
    > rhive.connect("grbd")

错误:java.lang.classnotfoundexception

vsikbqxv

vsikbqxv1#

您只需使用rhive包从r连接到hiveserver2
下面是我使用过的命令。
sys.setenv(hive\u home=“/usr/local/hive”)sys.setenv(hadoop\u home=“/usr/local/hadoop”)rhive.env(all=true)rhive.init()rhive.connect(“localhost”)

相关问题