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.

Hive ODBC cannot connect - Bad Status: HTTP/1.1 404 Not Found

SOLVED Go to solution
Highlighted

Hive ODBC cannot connect - Bad Status: HTTP/1.1 404 Not Found

New Contributor

We're using HiveServer2 on port 10001 with http as the transport and trying to connect via ODBC.  The installed driver is using ClouderaHiveODBC-2.5.19.1004-1.el7.x86_64.rpm.  We're running a 4-node CDH 5.7.1 cluster on CentOS 7.

 

$ grep -A2 hive.server2 hive-site.xml
hive-site.xml: <name>hive.server2.enable.doAs</name>
hive-site.xml- <value>true</value>
hive-site.xml- </property>
--
hive-site.xml: <name>hive.server2.use.SSL</name>
hive-site.xml- <value>false</value>
hive-site.xml- </property>
--
hive-site.xml: <name>hive.server2.transport.mode</name>
hive-site.xml- <value>http</value>
hive-site.xml- </property>
$ 

Here's the ODBC DSN configuration:

 

$ cat .odbc.ini 
[ODBC]
# Specify any global ODBC configuration here such as ODBC tracing.
Trace=yes
TraceFile=/tmp/novetta-odbc.trace

[ODBC Data Sources]
ClouderaHiveDSN=Cloudera ODBC Driver for Apache Hive

[ClouderaHiveDSN]

# Description: DSN Description.
# This key is not necessary and is only to give a description of the data source.
Description=Cloudera ODBC Driver for Apache Hive (64-bit) DSN

# Driver: The location where the ODBC driver is installed to.
Driver=/opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so

# When using No Service Discovery, specify the IP address or host name of the Hive server.
# When using ZooKeeper as the Service Discovery Mode, specify a comma-separated list of ZooKeeper 
# servers in the following format:
#       <zk_host1:zk_port1>,<zk_host2:zk_port2>,...
HOST=cdh-1

# The TCP port Hive server is listening. This is not required when using ZooKeeper as the service
# discovery mode as the port is specified in the HOST connection attribute.
PORT=10001

# The name of the database schema to use when a schema is not explicitly specified in a query.
Schema=default

# Set to 0 to when connecting directory to Hive Server 2 (No Service Discovery).
# Set to 1 to do Hive Server 2 service discovery using ZooKeeper.
# Note service discovery is not support when using Hive Server 1.
ServiceDiscoveryMode=0

# The namespace on ZooKeeper under which Hive Server 2 znodes are added. Required only when doing
# HS2 service discovery with ZooKeeper (ServiceDiscoveryMode=1).
ZKNamespace=

# Set to 1 if you are connecting to Hive Server 1. Set to 2 if you are connecting to Hive Server 2.
HiveServerType=2

# The authentication mechanism to use for the connection.
#   Set to 0 for No Authentication
#   Set to 1 for Kerberos
#   Set to 2 for User Name
#   Set to 3 for User Name and Password
# Note only No Authentication is supported when connecting to Hive Server 1.
AuthMech=3

# The Thrift transport to use for the connection.
#	Set to 0 for Binary
#	Set to 1 for SASL
#	Set to 2 for HTTP
# Note for Hive Server 1 only Binary can be used.
ThriftTransport=2

# When this option is enabled (1), the driver does not transform the queries emitted by an 
# application, so the native query is used.
# When this option is disabled (0), the driver transforms the queries emitted by an application and 
# converts them into an equivalent from in HiveQL.
UseNativeQuery=0

# Set the UID with the user name to use to access Hive when using AuthMech 2 to 8.
UID=novetta
PWD=novetta

# The following is settings used when using Kerberos authentication (AuthMech 1 and 10)

# The fully qualified host name part of the of the Hive Server 2 Kerberos service principal.
# For example if the service principal name of you Hive Server 2 is:
#   hive/myhs2.mydomain.com@EXAMPLE.COM
# Then set KrbHostFQDN to myhs2.mydomain.com
#KrbHostFQDN=[Hive Server 2 Host FQDN]

# The service name part of the of the Hive Server 2 Kerberos service principal.
# For example if the service principal name of you Hive Server 2 is:
#   hive/myhs2.mydomain.com@EXAMPLE.COM
# Then set KrbServiceName to hive
#KrbServiceName=[Hive Server 2 Kerberos service name]

# The realm part of the of the Hive Server 2 Kerberos service principal.
# For example if the service principal name of you Hive Server 2 is:
#   hive/myhs2.mydomain.com@EXAMPLE.COM
# Then set KrbRealm to EXAMPLE.COM
#KrbRealm=[Hive Server 2 Kerberos realm]

# Set to 1 to enable SSL. Set to 0 to disable.
SSL=0

# Set to 1 to enable two-way SSL. Set to 0 to disable. You must enable SSL in order to
# use two-way SSL.
TwoWaySSL=0

# The file containing the client certificate in PEM format. This is required when using two-way SSL.
ClientCert=

# The client private key. This is used for two-way SSL authentication.
ClientPrivateKey=

# The password for the client private key. Password is only required for password protected
# client private key.
ClientPrivateKeyPassword=

Here's the connection attempt:

 

$ isql -v ClouderaHiveDSN
[S1000][unixODBC][Cloudera][Hardy] (34) Error from server: Bad Status: HTTP/1.1 404 Not Found.
[ISQL]ERROR: Could not SQLConnect
$ 

And one from python:

 

$ cat hive_connect.py 
import os, sys, pyodbc
pyodbc.autocommit = True
con = pyodbc.connect("DSN=ClouderaHiveDSN", autocommit=True)

$ python hive_connect.py 
Traceback (most recent call last):
  File "hive_connect.py", line 3, in <module>
    con = pyodbc.connect("DSN=ClouderaHiveDSN", autocommit=True)
pyodbc.Error: ('HY000', '[HY000] [unixODBC][Cloudera][Hardy] (34) Error from server: Bad Status: HTTP/1.1 404 Not Found. (34) (SQLDriverConnect)')
$ 

Here are the driver configuration:

 

$ cat /platform/opt/cloudera/hiveodbc/lib/64/cloudera.hiveodbc.ini 
[Driver]

ErrorMessagesPath=/opt/cloudera/hiveodbc/ErrorMessages/
LogLevel=4
LogPath=/tmp/cloudera-hiveodbc
LogFileCount=10
LogFileSize=50
SwapFilePath=/tmp

And the driver logs:

 

$ head -n5000 /tmp/cloudera-hiveodbc/*
==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.1.log <==
Jun 21 14:33:18.491 INFO  510195520 CInterface::SQLFreeHandle: Freeing environment handle.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.2.log <==
Jun 21 14:33:18.490 INFO  510195520 CInterface::SQLFreeHandle: Freeing connection handle.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.3.log <==
Jun 21 14:33:18.486 INFO  510195520 CInterface::SQLAllocHandle: Allocating connection handle.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.4.log <==
Jun 21 14:33:18.486 INFO  510195520 Environment::SQLGetEnvAttr: Attribute: SQL_ATTR_ODBC_VERSION (200)

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.5.log <==
Jun 21 14:33:18.486 INFO  510195520 EnvironmentAttributes::SetAttribute: Setting ODBC version to: 3

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.6.log <==
Jun 21 14:33:18.485 INFO  510195520 Environment::SQLSetEnvAttr: Attribute: SQL_ATTR_ODBC_VERSION (200)

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.7.log <==
Jun 21 14:33:18.485 INFO  510195520 CInterface::SQLAllocHandle: Allocating environment handle.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.8.log <==
Jun 21 14:33:18.484 INFO  510195520 CInterface::SQLFreeHandle: Freeing environment handle.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.9.log <==
Jun 21 14:33:18.484 INFO  510195520 CInterface::SQLFreeHandle: Freeing connection handle.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive_connection_0.1.log <==
Jun 21 14:33:18.484 ERROR 510195520 Connection::SQLDriverConnectW: [Cloudera][Hardy] (34) Error from server: Bad Status: HTTP/1.1 404 Not Found.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive_connection_0.2.log <==
Jun 21 14:33:18.479 INFO  510195520 Connection::SQLSetConnectAttr: Attribute: SQL_ATTR_ANSI_APP (115)

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive_connection_0.log <==

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive_connection_1.1.log <==
Jun 21 14:33:18.490 ERROR 510195520 Connection::SQLDriverConnectW: [Cloudera][Hardy] (34) Error from server: Bad Status: HTTP/1.1 404 Not Found.

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive_connection_1.log <==

==> /tmp/cloudera-hiveodbc/ClouderaODBCDriverforApacheHive.log <==
$ 

And finally the hive logs:

 

2016-06-21 14:39:46,141 DEBUG org.eclipse.jetty.io.nio: [HiveServer2-HttpHandler-Pool: Thread-25 Selector1]: created SCEP@28fe9f21{l(/10.100.188.201:49957)<->r(/10.100.188.201:10001),d=false,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0}-{AsyncHttpConnection@6481448d,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}
2016-06-21 14:39:46,142 DEBUG org.eclipse.jetty.http.HttpParser: [HiveServer2-HttpHandler-Pool: Thread-44]: filled 271/271
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.server.Server: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: REQUEST / on AsyncHttpConnection@6481448d,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=2,l=26,c=35},r=1
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: scope null||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: context=||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: sessionManager=org.eclipse.jetty.server.session.HashSessionManager@7ea3883
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: session=null
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: servlet ||/ -> null
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: chain=null
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: Not Found /
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.server.Server: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: RESPONSE /  404
2016-06-21 14:39:46,143 DEBUG org.eclipse.jetty.http.HttpParser: [HiveServer2-HttpHandler-Pool: Thread-44]: filled 0/0
2016-06-21 14:39:46,144 DEBUG org.eclipse.jetty.http.HttpParser: [HiveServer2-HttpHandler-Pool: Thread-44]: filled 287/287
2016-06-21 14:39:46,144 DEBUG org.eclipse.jetty.server.Server: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: REQUEST / on AsyncHttpConnection@6481448d,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=2,l=26,c=51},r=2
2016-06-21 14:39:46,144 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: scope null||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,144 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: context=||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,144 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: sessionManager=org.eclipse.jetty.server.session.HashSessionManager@7ea3883
2016-06-21 14:39:46,145 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: session=null
2016-06-21 14:39:46,145 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: servlet ||/ -> null
2016-06-21 14:39:46,145 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: chain=null
2016-06-21 14:39:46,145 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: Not Found /
2016-06-21 14:39:46,145 DEBUG org.eclipse.jetty.server.AbstractHttpConnection: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: 
org.eclipse.jetty.io.EofException
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:939)
	at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:438)
	at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:94)
	at org.eclipse.jetty.server.AbstractHttpConnection$Output.flush(AbstractHttpConnection.java:1000)
	at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:173)
	at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:101)
	at org.eclipse.jetty.util.ByteArrayISO8859Writer.writeTo(ByteArrayISO8859Writer.java:102)
	at org.eclipse.jetty.server.Response.sendError(Response.java:374)
	at org.eclipse.jetty.server.Response.sendError(Response.java:399)
	at org.eclipse.jetty.servlet.ServletHandler.notFound(ServletHandler.java:1235)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:461)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
	at org.eclipse.jetty.server.Server.handle(Server.java:345)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Broken pipe
	at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
	at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
	at sun.nio.ch.IOUtil.write(IOUtil.java:148)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
	at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.gatheringFlush(ChannelEndPoint.java:385)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:337)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:319)
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:863)
	... 28 more
2016-06-21 14:39:46,146 DEBUG org.eclipse.jetty.io.nio.ChannelEndPoint: [HiveServer2-HttpHandler-Pool: Thread-44]: oshut SCEP@28fe9f21{l(/10.100.188.201:49957)<->r(/10.100.188.201:10001),d=true,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=1r}-{AsyncHttpConnection@6481448d,g=HttpGenerator{s=2,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2}
2016-06-21 14:39:46,146 DEBUG org.eclipse.jetty.io.nio: [HiveServer2-HttpHandler-Pool: Thread-44]: EOF
org.eclipse.jetty.io.EofException
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:939)
	at org.eclipse.jetty.http.HttpGenerator.complete(HttpGenerator.java:823)
	at org.eclipse.jetty.server.AbstractHttpConnection.completeResponse(AbstractHttpConnection.java:608)
	at org.eclipse.jetty.server.Response.complete(Response.java:1178)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:521)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.ClosedChannelException
	at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:267)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:512)
	at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.gatheringFlush(ChannelEndPoint.java:385)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:337)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:319)
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:863)
	... 13 more
2016-06-21 14:39:46,146 DEBUG org.eclipse.jetty.io.nio.ChannelEndPoint: [HiveServer2-HttpHandler-Pool: Thread-44]: close SCEP@28fe9f21{l(/10.100.188.201:49957)<->r(/10.100.188.201:10001),d=true,open=true,ishut=false,oshut=true,rb=false,wb=false,w=true,i=1r}-{AsyncHttpConnection@6481448d,g=HttpGenerator{s=3,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2}
2016-06-21 14:39:46,148 DEBUG org.eclipse.jetty.io.nio: [HiveServer2-HttpHandler-Pool: Thread-25 Selector1]: destroyEndPoint SCEP@28fe9f21{l(null)<->r(0.0.0.0/0.0.0.0:10001),d=false,open=false,ishut=true,oshut=true,rb=false,wb=false,w=true,i=1!}-{AsyncHttpConnection@6481448d,g=HttpGenerator{s=3,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2}
2016-06-21 14:39:46,148 DEBUG org.eclipse.jetty.io.nio: [HiveServer2-HttpHandler-Pool: Thread-24 Selector0]: created SCEP@72b8a756{l(/10.100.188.201:49958)<->r(/10.100.188.201:10001),d=false,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=0}-{AsyncHttpConnection@38f239f1,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=-14,l=0,c=0},r=0}
2016-06-21 14:39:46,148 DEBUG org.eclipse.jetty.server.AbstractHttpConnection: [HiveServer2-HttpHandler-Pool: Thread-25 Selector1]: closed AsyncHttpConnection@6481448d,g=HttpGenerator{s=3,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2
2016-06-21 14:39:46,148 DEBUG org.eclipse.jetty.http.HttpParser: [HiveServer2-HttpHandler-Pool: Thread-44]: filled 271/271
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.server.Server: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: REQUEST / on AsyncHttpConnection@38f239f1,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=2,l=26,c=35},r=1
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: scope null||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: context=||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: sessionManager=org.eclipse.jetty.server.session.HashSessionManager@7ea3883
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: session=null
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: servlet ||/ -> null
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: chain=null
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: Not Found /
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.server.Server: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: RESPONSE /  404
2016-06-21 14:39:46,149 DEBUG org.eclipse.jetty.http.HttpParser: [HiveServer2-HttpHandler-Pool: Thread-44]: filled 0/0
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.http.HttpParser: [HiveServer2-HttpHandler-Pool: Thread-44]: filled 287/287
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.server.Server: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: REQUEST / on AsyncHttpConnection@38f239f1,g=HttpGenerator{s=0,h=-1,b=-1,c=-1},p=HttpParser{s=2,l=26,c=51},r=2
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: scope null||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.server.handler.ContextHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: context=||/ @ o.e.j.s.ServletContextHandler{/,null}
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: sessionManager=org.eclipse.jetty.server.session.HashSessionManager@7ea3883
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.server.session: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: session=null
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: servlet ||/ -> null
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: chain=null
2016-06-21 14:39:46,150 DEBUG org.eclipse.jetty.servlet.ServletHandler: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: Not Found /
2016-06-21 14:39:46,151 DEBUG org.eclipse.jetty.server.AbstractHttpConnection: [HiveServer2-HttpHandler-Pool: Thread-44 - /]: 
org.eclipse.jetty.io.EofException
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:939)
	at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:438)
	at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:94)
	at org.eclipse.jetty.server.AbstractHttpConnection$Output.flush(AbstractHttpConnection.java:1000)
	at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:173)
	at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:101)
	at org.eclipse.jetty.util.ByteArrayISO8859Writer.writeTo(ByteArrayISO8859Writer.java:102)
	at org.eclipse.jetty.server.Response.sendError(Response.java:374)
	at org.eclipse.jetty.server.Response.sendError(Response.java:399)
	at org.eclipse.jetty.servlet.ServletHandler.notFound(ServletHandler.java:1235)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:461)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
	at org.eclipse.jetty.server.Server.handle(Server.java:345)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Broken pipe
	at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
	at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
	at sun.nio.ch.IOUtil.write(IOUtil.java:148)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:524)
	at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.gatheringFlush(ChannelEndPoint.java:385)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:337)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:319)
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:863)
	... 28 more
2016-06-21 14:39:46,151 DEBUG org.eclipse.jetty.io.nio.ChannelEndPoint: [HiveServer2-HttpHandler-Pool: Thread-44]: oshut SCEP@72b8a756{l(/10.100.188.201:49958)<->r(/10.100.188.201:10001),d=true,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=1r}-{AsyncHttpConnection@38f239f1,g=HttpGenerator{s=2,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2}
2016-06-21 14:39:46,151 DEBUG org.eclipse.jetty.io.nio: [HiveServer2-HttpHandler-Pool: Thread-44]: EOF
org.eclipse.jetty.io.EofException
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:939)
	at org.eclipse.jetty.http.HttpGenerator.complete(HttpGenerator.java:823)
	at org.eclipse.jetty.server.AbstractHttpConnection.completeResponse(AbstractHttpConnection.java:608)
	at org.eclipse.jetty.server.Response.complete(Response.java:1178)
	at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:521)
	at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:925)
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:857)
	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.nio.channels.ClosedChannelException
	at sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:267)
	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:512)
	at java.nio.channels.SocketChannel.write(SocketChannel.java:493)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.gatheringFlush(ChannelEndPoint.java:385)
	at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:337)
	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:319)
	at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:863)
	... 13 more
2016-06-21 14:39:46,152 DEBUG org.eclipse.jetty.io.nio.ChannelEndPoint: [HiveServer2-HttpHandler-Pool: Thread-44]: close SCEP@72b8a756{l(/10.100.188.201:49958)<->r(/10.100.188.201:10001),d=true,open=true,ishut=false,oshut=true,rb=false,wb=false,w=true,i=1r}-{AsyncHttpConnection@38f239f1,g=HttpGenerator{s=3,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2}
2016-06-21 14:39:46,153 DEBUG org.eclipse.jetty.io.nio: [HiveServer2-HttpHandler-Pool: Thread-24 Selector0]: destroyEndPoint SCEP@72b8a756{l(null)<->r(0.0.0.0/0.0.0.0:10001),d=false,open=false,ishut=true,oshut=true,rb=false,wb=false,w=true,i=1!}-{AsyncHttpConnection@38f239f1,g=HttpGenerator{s=3,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2}
2016-06-21 14:39:46,153 DEBUG org.eclipse.jetty.server.AbstractHttpConnection: [HiveServer2-HttpHandler-Pool: Thread-24 Selector0]: closed AsyncHttpConnection@38f239f1,g=HttpGenerator{s=3,h=174,b=1267,c=-1},p=HttpParser{s=2,l=26,c=51},r=2

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Hive ODBC cannot connect - Bad Status: HTTP/1.1 404 Not Found

New Contributor

Solved it.

 

According to page 68 of the installation guide, you set the HttpPath parameter in your odbc.ini file, but that failed to work:

 

$ tail .odbc.ini 

# The client private key. This is used for two-way SSL authentication.
ClientPrivateKey=

# The password for the client private key. Password is only required for password protected
# client private key.
ClientPrivateKeyPassword=

HttpPath=/cliservice

$ isql -v ClouderaHiveDSN
[S1000][unixODBC][Cloudera][Hardy] (34) Error from server: Bad Status: HTTP/1.1 404 Not Found.
[ISQL]ERROR: Could not SQLConnect
$ 

So I looked for path strings in the driver:

 

$ strings /opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so | grep -i path
m_httpPath: %s
m_trustedCertsPath: %s
HttpPathPrefix
...

I changed the paramter from HttpPath to HttpPathPrefix and was able to connect:

 

[novetta@cdh-1 ~]$ tail .odbc.ini 

# The client private key. This is used for two-way SSL authentication.
ClientPrivateKey=

# The password for the client private key. Password is only required for password protected
# client private key.
ClientPrivateKeyPassword=

HttpPathPrefix=/cliservice

[novetta@cdh-1 ~]$ isql -v ClouderaHiveDSN
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 

Hope it helps!

1 REPLY 1

Re: Hive ODBC cannot connect - Bad Status: HTTP/1.1 404 Not Found

New Contributor

Solved it.

 

According to page 68 of the installation guide, you set the HttpPath parameter in your odbc.ini file, but that failed to work:

 

$ tail .odbc.ini 

# The client private key. This is used for two-way SSL authentication.
ClientPrivateKey=

# The password for the client private key. Password is only required for password protected
# client private key.
ClientPrivateKeyPassword=

HttpPath=/cliservice

$ isql -v ClouderaHiveDSN
[S1000][unixODBC][Cloudera][Hardy] (34) Error from server: Bad Status: HTTP/1.1 404 Not Found.
[ISQL]ERROR: Could not SQLConnect
$ 

So I looked for path strings in the driver:

 

$ strings /opt/cloudera/hiveodbc/lib/64/libclouderahiveodbc64.so | grep -i path
m_httpPath: %s
m_trustedCertsPath: %s
HttpPathPrefix
...

I changed the paramter from HttpPath to HttpPathPrefix and was able to connect:

 

[novetta@cdh-1 ~]$ tail .odbc.ini 

# The client private key. This is used for two-way SSL authentication.
ClientPrivateKey=

# The password for the client private key. Password is only required for password protected
# client private key.
ClientPrivateKeyPassword=

HttpPathPrefix=/cliservice

[novetta@cdh-1 ~]$ isql -v ClouderaHiveDSN
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> 

Hope it helps!