Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

beeline command arguments fail

avatar
Explorer

Hello team,

I have a knox target that has JDBC connected to it. However although I'm happily connecting interactively, using command arguments for the url seem to be providing grief. I'm using Beeline 1.2.1000.2.5.3.0-37 could this be a bug?

This works:

[theuser@knoxhost ~]$ beeline
Beeline version 1.2.1000.2.5.3.0-37 by Apache Hive
beeline> !connect jdbc:hive2://knoxhost.domain.com:8443/default;ssl=true;transportMode=http;httpPath=gateway/default/hive theuser secret
Connecting to jdbc:hive2://knoxhost.domain.com:8443/default;ssl=true;transportMode=http;httpPath=gateway/default/hive
Connected to: Apache Hive (version 1.2.1000.2.5.3.0-37)
Driver: Hive JDBC (version 1.2.1000.2.5.3.0-37)
Transaction isolation: TRANSACTION_REPEATABLE_READ
0: jdbc:hive2://knoxhost.domain.com>

This does not work:

[theuser@knoxhost ~]$ beeline -u 
'jdbc:hive2://knoxhost.domain.com:8443/default;transportMode=http;ssl=true'
 -n theuser -p password (or -w password.txt)
Connecting to jdbc:hive2://knoxhost.domain.com:8443/default;transportMode=http;ssl=true
17/02/23 19:11:01 [main]: ERROR jdbc.HiveConnection: Error opening session
org.apache.thrift.transport.TTransportException: HTTP Response code: 404
  at org.apache.thrift.transport.THttpClient.flushUsingHttpClient(THttpClient.java:262)
  at org.apache.thrift.transport.THttpClient.flush(THttpClient.java:313)
  at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:73)
  at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:62)
  at org.apache.hive.service.cli.thrift.TCLIService$Client.send_OpenSession(TCLIService.java:154)
  at org.apache.hive.service.cli.thrift.TCLIService$Client.OpenSession(TCLIService.java:146)
  at org.apache.hive.jdbc.HiveConnection.openSession(HiveConnection.java:552)
  at org.apache.hive.jdbc.HiveConnection.<init>(HiveConnection.java:170)
  at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
  at java.sql.DriverManager.getConnection(DriverManager.java:664)
  at java.sql.DriverManager.getConnection(DriverManager.java:208)
  at org.apache.hive.beeline.DatabaseConnection.connect(DatabaseConnection.java:146)
  at org.apache.hive.beeline.DatabaseConnection.getConnection(DatabaseConnection.java:211)
  at org.apache.hive.beeline.Commands.connect(Commands.java:1190)
  at org.apache.hive.beeline.Commands.connect(Commands.java:1086)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.apache.hive.beeline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:52)
  at org.apache.hive.beeline.BeeLine.dispatch(BeeLine.java:990)
  at org.apache.hive.beeline.BeeLine.initArgs(BeeLine.java:715)
  at org.apache.hive.beeline.BeeLine.begin(BeeLine.java:777)
  at org.apache.hive.beeline.BeeLine.mainWithInputRedirection(BeeLine.java:491)
  at org.apache.hive.beeline.BeeLine.main(BeeLine.java:474)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.apache.hadoop.util.RunJar.run(RunJar.java:233)
  at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
Error:
 Could not establish connection to 
jdbc:hive2://knoxhost.domain.com:8443/default;transportMode=http;ssl=true:
 HTTP Response code: 404 (state=08S01,code=0)
Beeline version 1.2.1000.2.5.3.0-37 by Apache Hive
0: jdbc:hive2://knoxhost.domain.com (closed)>
1 ACCEPTED SOLUTION

avatar
New Contributor

Hello,

Your attempt that does not work is missing the "httpPath=gateway/default/hive" in the connection string. Adding that should solve your issue.

Hope this helps!

View solution in original post

3 REPLIES 3

avatar
New Contributor

Hello,

Your attempt that does not work is missing the "httpPath=gateway/default/hive" in the connection string. Adding that should solve your issue.

Hope this helps!

avatar
Explorer

whoops. Thanks for the pickup.

avatar
Explorer

Hi, I am facing the same error. My hdp sandbox is kerberized.

Error: Could not establish connection to jdbc:hive2://sandbox-hdp.hortonworks.com:8443/;ssl=true;sslTrustStore=/var/lib/knox/data-2.6.5.0-292/security/keystores/gateway.jks;trustStorePassword=knox;transportMode=http;httpPath=gateway/default/hive: HTTP Response code: 401 (state=08S01,code=0) Beeline version 1.2.1000.2.6.5.0-292 by Apache Hive 0: jdbc:hive2://sandbox-hdp.hortonworks.com:8 (closed)>

can you pls help me what I am doing wrong here?