Support Questions
Find answers, ask questions, and share your expertise

TApplicationException: Required field 'client_protocol' is unset

New Contributor

I am developing a thrift client,


I have build a thrift hive server(apache-hive-0.14.0) on my machine and am also have access to Cloudera Dist Hive 4.6.0


When i connect thrift client to CDH client give following error:


TApplicationException: Required field 'client_protocol' is unset!
Struct:TOpenSessionReq(client_protocol:null, username:

I am passing the right protocol to the server but it seems some thing is over riding it....


Moreover if I point to localhost(where i have my hive server running) every thing seems to working fine....


Please let me know what is wrong here....



        var socket = new TSocket("XXX.XXX.XXX.XXX", 10000);

        TStreamTransport sTransport = (TStreamTransport)socket;

        var transport = new TBufferedTransport(socket);

        underlyingTransport = transport;

        var proto = new TBinaryProtocol(transport);
        var client = new TCLIService.Client(proto);

        TOpenSessionReq req = new TOpenSessionReq(TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V6);
        req.Username = "hive";
        req.Password = "hive";

        TOpenSessionResp oSResponse = client.OpenSession(req);
        TSessionHandle sessionHandle = oSResponse.SessionHandle;

        TExecuteStatementReq execReq = new TExecuteStatementReq(sessionHandle, "select * from emp");
        TExecuteStatementResp exeRes= client.ExecuteStatement(execReq);
        TOperationHandle operationHandle = exeRes.OperationHandle;

        TFetchResultsReq fechReq = new TFetchResultsReq(operationHandle,TFetchOrientation.FETCH_FIRST, 1);
        TFetchResultsResp fechRes = client.FetchResults(fechReq);

        TRowSet results = fechRes.Results;
        List<TRow> resultRows = results.Rows;
        foreach (var row in resultRows)
            var val = row.ColVals[0];

        TCloseOperationReq closeOprReq = new TCloseOperationReq(operationHandle);

        TCloseSessionReq creq = new TCloseSessionReq(sessionHandle);


This indicates a version mismatch between client and server, namely that the client is newer than the server, which is your case.  If you cant upgrade your hive server, try to build a compatible thrift client, ie not from apache-hive 0.14,  but from cdh 4.6 hive version (0.10).


Hope that helps,