JDBC客户端到Hive - 流中没有数据或没有sasl数据异常

时间:2016-06-01 07:36:11

标签: authentication jdbc hive kerberos oozie

我们有一个Kerberised集群,我试图在Oozie中运行Java操作,在那里我与Hive建立JDBC连接。这个JDBC连接在没有Kerberos的Sandbox上运行良好。

连接字符串如下所示,我在其中提供用户名和密码:

Connection con = DriverManager.getConnection("jdbc:hive2://W12345:10000/control;principal=hive/W12345.companynet.net@COMPANYNET.NET","user123","passw123");

Oozie操作(奇怪地)成功完成,Java操作日志不会出现任何错误:

1742 [main] INFO org.apache.hive.jdbc.Utils  - Supplied authorities: W12345:10000
1742 [main] INFO org.apache.hive.jdbc.Utils  - Resolved authority: W12345:10000
1766 [main] INFO org.apache.hive.jdbc.HiveConnection  - Will try to open client transport with JDBC Uri: jdbc:hive2://W12345:10000/control;principal=hive/W12345.companynet.net@COMPANYNET.NET
<<< Invocation of Main class completed <<<
Oozie Launcher ends
1785 [main] INFO org.apache.hadoop.mapred.Task  - Task:attempt_1464245290012_0129_m_000000_0 is done. And is in the process of committing
1847 [main] INFO org.apache.hadoop.mapred.Task  - Task attempt_1464245290012_0129_m_000000_0 is allowed to commit now
1854 [main] INFO org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter  - Saved output of task 'attempt_1464245290012_0129_m_000000_0' to hdfs://danskehadoop/user/user123/oozie-oozi/0000013-160527101253015-oozie-oozi-W/JavaAction--java/output/_temporary/1/task_1464245290012_0129_m_000000
1909 [main] INFO org.apache.hadoop.mapred.Task  - Task 'attempt_1464245290012_0129_m_000000_0' done.

但实际上Java main没有正确完成执行(并且没有执行所需的查询),因为JDBC连接失败,我只能在Hive日志中看到异常:

    ERROR [HiveServer2-Handler-Pool: Thread-78363]: server.TThreadPoolServer (TThreadPoolServer.java:run(296)) - Error occurred during processing of message.
java.lang.RuntimeException: org.apache.thrift.transport.TSaslTransportException: No data or no sasl data in the stream
  at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:219)
  at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingTransportFactory$1.run(HadoopThriftAuthBridge.java:739)
  at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingTransportFactory$1.run(HadoopThriftAuthBridge.java:736)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.security.auth.Subject.doAs(Subject.java:360)
  at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1637)
  at org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge$Server$TUGIAssumingTransportFactory.getTransport(HadoopThriftAuthBridge.java:736)
  at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:268)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.thrift.transport.TSaslTransportException: No data or no sasl data in the stream
  at org.apache.thrift.transport.TSaslTransport.open(TSaslTransport.java:328)
  at org.apache.thrift.transport.TSaslServerTransport.open(TSaslServerTransport.java:41)
  at org.apache.thrift.transport.TSaslServerTransport$Factory.getTransport(TSaslServerTransport.java:216)
  ... 10 more

我实际连接到群集,并且已经在我的用户名上进一步完成了kinit。

有人知道这个例外的原因是什么吗?

提前感谢您的帮助!

安东尼奥

1 个答案:

答案 0 :(得分:0)

这在MapR hadoop分发平台上发生了。 就我而言,这是Keepalived每5秒检查一次Hive端口并产生这样的错误。我只是使用“ nc”命令来检查Hive端口是否正在使用,并且未使用任何身份验证方法。后来我切换到使用SASL身份验证的“ maprcli”命令,该错误消失了。