Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Cannot connect to spark-sql 2.1 from hive-2.1 through beeline

Highlighted

Cannot connect to spark-sql 2.1 from hive-2.1 through beeline

Contributor

Team,

I am using HDP-2.6 and kerberos with hive1.2 and hive2.1 enabled. I have installed interactive hiveserver2 and it is running properly. I am facing the issue with beeline. I have spark2 installed and spark thrift server running. When I try to access from hive1.2-beeline, it works properly

Beeline version 1.2.1000.2.6.0.3-8 by Apache Hive
beeline> !connect jdbc:hive2://hdp-qa7-n1.example.com:10016/default;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM
Connecting to jdbc:hive2://hdp-qa7-n1.example.com:10016/default;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM
Enter username for jdbc:hive2://hdp-qa7-n1.example.com:10016/default;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM: rahul
Enter password for jdbc:hive2://hdp-qa7-n1.example.com:10016/default;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM: ***********
Connected to: Spark SQL (version 2.1.0.2.6.0.3-8)
Driver: Hive JDBC (version 1.2.1000.2.6.0.3-8)
Transaction isolation: TRANSACTION_REPEATABLE_READ

But when I try to access from hive2.1-beeline it doesn't work. Can you please help where I am doing wrong?

Beeline version 2.1.0.2.6.0.3-8 by Apache Hive
beeline> !connect jdbc:hive2://hdp-qa7-n1.example.com:10016/;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM
Connecting to jdbc:hive2://hdp-qa7-n1.example.com:10016/;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM
17/06/20 22:36:22 [main]: ERROR jdbc.HiveConnection: 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) ~[hive-exec-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:79) ~[hive-exec-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.service.rpc.thrift.TCLIService$Client.recv_OpenSession(TCLIService.java:168) ~[hive-exec-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.service.rpc.thrift.TCLIService$Client.OpenSession(TCLIService.java:155) ~[hive-exec-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:578) [hive-jdbc-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:188) [hive-jdbc-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:107) [hive-jdbc-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at java.sql.DriverManager.getConnection(DriverManager.java:664) [?:1.8.0_121]
        at java.sql.DriverManager.getConnection(DriverManager.java:208) [?:1.8.0_121]
        at org.apache.hive.beeline.DatabaseConnection.connect(DatabaseConnection.java:145) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.DatabaseConnection.getConnection(DatabaseConnection.java:209) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.Commands.connect(Commands.java:1509) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.Commands.connect(Commands.java:1404) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at org.apache.hive.beeline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:52) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.BeeLine.execCommandWithPrefix(BeeLine.java:1104) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:1143) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.BeeLine.execute(BeeLine.java:976) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:886) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:502) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at org.apache.hive.beeline.BeeLine.main(BeeLine.java:485) [hive-beeline-2.1.0.2.6.0.3-8.jar:2.1.0.2.6.0.3-8]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at org.apache.hadoop.util.RunJar.run(RunJar.java:233) [hadoop-common-2.7.3.2.6.0.3-8.jar:?]
        at org.apache.hadoop.util.RunJar.main(RunJar.java:148) [hadoop-common-2.7.3.2.6.0.3-8.jar:?]
17/06/20 22:36:23 [main]: WARN jdbc.HiveConnection: Failed to connect to hdp-qa7-n1.example.com:10016
Error: Could not open client transport with JDBC Uri: jdbc:hive2://hdp-qa7-n1.example.com:10016/;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM: Could not establish connection to jdbc:hive2://hdp-qa7-n1.example.com:10016/;principal=hive/hdp-qa7-n1.example.com@EXAMPLE.COM: Required field 'client_protocol' is unset! Struct:TOpenSessionReq(client_protocol:null, configuration:{use:database=default}) (state=08S01,code=0)
3 REPLIES 3
Highlighted

Re: Cannot connect to spark-sql 2.1 from hive-2.1 through beeline

New Contributor

Hi @rahulburagohain, were you able to solve this issue? I have the same issue try to troubleshoot. If you solved it, it will be great help to know what is worked. Thanks

Highlighted

Re: Cannot connect to spark-sql 2.1 from hive-2.1 through beeline

Explorer

Hi @Rahul Buragohain, we are getting same issue with connecting to Spark2 thrift server, were you able to get any resolution for this?

Appreciate your help in Advance.

Thanks.

Re: Cannot connect to spark-sql 2.1 from hive-2.1 through beeline

Contributor

I have changed the default hive 1.2 to hive 2.1 in hive-env.sh and then it worked properly.

Don't have an account?
Coming from Hortonworks? Activate your account here