/testjavaperl/lib/zookeeper-3.4.6.jar
May 05, 2016 8:53:26 AM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: hdp-hiveserver-prd.app.paic.com.cn:10000
May 05, 2016 8:53:26 AM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: hdp-hiveserver-prd.app.paic.com.cn:10000
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
May 05, 2016 8:53:27 AM org.apache.hive.jdbc.HiveConnection openTransport
INFO: Will try to open client transport with JDBC Uri: jdbc:hive2://hdp-hiveserver-prd.app.paic.com.cn:10000
May 05, 2016 8:53:28 AM org.apache.hive.jdbc.HiveConnection openSession
SEVERE: Error opening session
org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:156)
at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:143)
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:583)
at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:192)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at HiveJdbcJobTest.main(HiveJdbcJobTest.java:28)
Exception in thread "main" java.sql.SQLException: Could not establish connection to jdbc:hive2://hdp-hiveserver-prd.app.paic.com.cn:10000: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:594)
at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:192)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at HiveJdbcJobTest.main(HiveJdbcJobTest.java:28)
Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:156)
at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:143)
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:583)
May 05, 2016 8:53:26 AM org.apache.hive.jdbc.Utils parseURL
INFO: Supplied authorities: hdp-hiveserver-prd.app.paic.com.cn:10000
May 05, 2016 8:53:26 AM org.apache.hive.jdbc.Utils parseURL
INFO: Resolved authority: hdp-hiveserver-prd.app.paic.com.cn:10000
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
May 05, 2016 8:53:27 AM org.apache.hive.jdbc.HiveConnection openTransport
INFO: Will try to open client transport with JDBC Uri: jdbc:hive2://hdp-hiveserver-prd.app.paic.com.cn:10000
May 05, 2016 8:53:28 AM org.apache.hive.jdbc.HiveConnection openSession
SEVERE: Error opening session
org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:156)
at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:143)
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:583)
at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:192)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at HiveJdbcJobTest.main(HiveJdbcJobTest.java:28)
Exception in thread "main" java.sql.SQLException: Could not establish connection to jdbc:hive2://hdp-hiveserver-prd.app.paic.com.cn:10000: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:594)
at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:192)
at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at HiveJdbcJobTest.main(HiveJdbcJobTest.java:28)
Caused by: org.apache.thrift.TApplicationException: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default})
at org.apache.thrift.TApplicationException.read(TApplicationException.java:111)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:71)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:156)
at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:143)
at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:583)
... 5 more
此问题时由于jdbc版本不对造成的,现给予相应的包版本如下:
hive-jdbc-0.13.1.jar(特别注意此版本)
hadoop-common-2.6.0-cdh5.4.2.jar
zookeeper-3.4.6.jar
slf4j-api-1.7.5.jar
libthrift-0.9.2.jar
httpcore-4.4.jar
httpclient-4.4.jar
hive-service-0.13.1.jar
hive-metastore-0.13.1.jar
hive-exec-0.13.1.jar
curator-client-2.6.0.jar
commons-logging-1.1.3.jar
curator-recipes-2.6.0.jar
curator-framework-2.6.0.jar