org.apache.thrift.transport.ttTransportException:没有端口就无法打开?

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

那里
我是新来的 Hive ,以及使用kerberos身份验证访问配置单元的java应用程序,如下所示:

try
        {
            System.setProperty("java.security.krb5.conf", "/haManage/krb5.conf");
            StringBuilder sBuilder = new StringBuilder();
            sBuilder.append("jdbc:hive2://ha-cluster/default");
            sBuilder.append(";zk.quorum=").append("x.x.x.x,x.x.x.x");//ip list
            sBuilder.append(";zk.port=").append("24002");
            if (isSecureVer) {
                sBuilder.append(";user.principal=")
                        .append("hadoop@HADOOP.COM")
                        .append(";user.keytab=")
                        .append("/home/hdclient/gyj/user.keytab")
                        .append(";sasl.qop=auth-conf;auth=KERBEROS;principal=hive/" +
                                "hadoop.hadoop.com@HADOOP.COM;zk.principal=zookeeper/hadoop.hadoop.com");
            }
            url = sBuilder.toString();
            logger.info(url);
            Class.forName("org.apache.hive.jdbc.HiveDriver");
            connToHive = DriverManager.getConnection(url,"","");
        } catch (Exception e)
        {
            logger.error("Error occurs",e);
        }

但有例外,如下所示:

Caused by: org.apache.thrift.transport.TTransportException: Cannot open without port. 
    at org.apache.thrift.transport.TSocket.open(TSocket.java:172) ~[hive-exec-0.14.0.jar:0.14.0] 
    at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:248) ~[hive-exec-0.14.0.jar:0.14.0] 
    at org.apache.thrift.transport.TSaslClientTransport.open(TSaslClientTransport.java:37) ~[hive-exec-0.14.0.jar:0.14.0] 
    at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport$1.run(TUGIAssumingTransport.java:52) ~[hive-exec-0.14.0.jar:0.14.0] 
    at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport$1.run(TUGIAssumingTransport.java:49) ~[hive-exec-0.14.0.jar:0.14.0] 
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_45] 
    at javax.security.auth.Subject.doAs(Subject.java:415) ~[na:1.7.0_45] 
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1656) ~[hadoop-common-2.6.4.jar:na] 
    at org.apache.hadoop.hive.thrift.client.TUGIAssumingTransport.open(TUGIAssumingTransport.java:49) ~[hive-exec-0.14.0.jar:0.14.0] 
    at org.apache.hive.jdbc.HiveConnection.openTransport(HiveConnection.java:190) ~[hive-jdbc-1.1.0.jar:1.1.0] 
    ... 6 common frames omitted

任何努力都将不胜感激。

8aqjt8rx

8aqjt8rx1#

在将zookeeper端口指定为查询字符串参数(kerberos auth所需)的同时,还需要在url的hostname部分之后为配置单元指定端口。配置单元使用的正常端口是10000,因此您的url可能以以下方式开始:

sBuilder.append("jdbc:hive2://ha-cluster:10000/default");

相关问题