possible cause for NoHttpResponseException?

Poster Content
nk4um User
Posts: 27
August 17, 2015 19:08

Hi Peter,

We have re-deployed to a new server. However we haven't tested this issue yet. I will let you know its status later. Thank you very much.

Regards, Yang

Posted by pjr (View)
Please can you put the trace in Dropbox or something similar and email me the link? (ask Paul if you don't already have my email).

However, I think, as you indicate, that the visualizer is not going to help - since this is something at the protocol level in the stream response from the remote host.

The tool that you may need to diagnose this is something like wireshark - which is available on most linux distros.

Like · Post Reply
nk4um Moderator
Posts: 901
July 2, 2015 11:32

Please can you put the trace in Dropbox or something similar and email me the link? (ask Paul if you don't already have my email).

However, I think, as you indicate, that the visualizer is not going to help - since this is something at the protocol level in the stream response from the remote host.

The tool that you may need to diagnose this is something like wireshark - which is available on most linux distros.

Like · Post Reply
nk4um User
Posts: 27
July 1, 2015 14:27

Hi Peter,

Thank you very much for your reply.

Yeah, I did try curl before posting and it works properly, returning status code 200 or 401. That's why I get confused and looking for possible reasons.

So according to your suggestion, I tried to trace the request with visualizer, and compared the two traces from both development and production environment. All the first 20 subrequests have the same results, but then the one in development environment which really performs HTTP POST will return a binary stream while the one in production returns an exception, and the response is the one I posted in the first post.

It seems I cannot upload an attachment. How can I send the request trace file to you? Thank you.

Regards,

Yang

Posted by pjr (View)
According to the Apache client API this appears to be a low level error at the HTTP protocol level...

https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/NoHttpResponseException.html

"Signals that the target server failed to respond with a valid HTTP response."

Its being thrown when the response stream is being parsed as HTTP - so its very hard to say what the server is actually returning.

Have you tried a curl request to the server from the same machine as NK is deployed on? This would show you what's coming back?

At the NK-level your use of the HTTP endpoints looks to be fine - but it wouldn't hurt to send us a visualizer trace of the full request sequence so that we can see if there is anything amiss.

P.

Like · Post Reply
nk4um Moderator
Posts: 901
July 1, 2015 12:30

According to the Apache client API this appears to be a low level error at the HTTP protocol level...

https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/NoHttpResponseException.html

"Signals that the target server failed to respond with a valid HTTP response."

Its being thrown when the response stream is being parsed as HTTP - so its very hard to say what the server is actually returning.

Have you tried a curl request to the server from the same machine as NK is deployed on? This would show you what's coming back?

At the NK-level your use of the HTTP endpoints looks to be fine - but it wouldn't hurt to send us a visualizer trace of the full request sequence so that we can see if there is anything amiss.

P.

Like · Post Reply
nk4um User
Posts: 27
July 1, 2015 11:58possible cause for NoHttpResponseException?

Hi there,

I am encountering a strange exception and looking for possible causes now.

I want to request a remote rest service with Netkernel Http Client Module, and the relevant code is as follows:

        INKFRequest request = context.createRequest("active:httpPost");
        request.addArgument("url", requestPath);
        HDSBuilder body = new HDSBuilder();
        body.pushNode("state", "offline");
        request.addArgumentByValue("nvp", body.getRoot());
        request.addArgument("state", authStateId);
        INKFResponseReadOnly response = context.issueRequestForResponse(request);

The remote service requires basic authentication, and the credentials are wrapped with "authStateId" which comes from

         IHDSNode credentials = null;
        if (context.exists("backup:credentials")) {
            credentials = context.source("backup:credentials", IHDSNode.class);
        } else {
            logMsg = "SPARQL endpoint credentials for backup \"backup:credentials\" must be present in module definition!";
            context.logRaw(INKFRequestContext.LEVEL_SEVERE, logMsg);
            thrownew IllegalArgumentException(logMsg);
        }
        INKFRequest request = context.createRequest("active:httpState");
        request.setVerb(INKFRequestReadOnly.VERB_NEW);
        request.addArgumentByValue("credentials", credentials);
        return context.issueRequest(request).toString();

I tested at my local development environment and it works properly. However when I deploy it to production environment, it gives me an exception

<ex>
  <ex>
    <id>RequestFrameException&lt;/id&gt;
    <requestDecoded>active:httpPost+nvp@pbv:nvp+state@active:httpState+id@F8FA009B28D26348A7ACCA46B054CB41+url@http://fuseki-on-1270:3030/$/datasets/archive&lt;/requestDecoded&gt;
    <verb>SOURCE&lt;/verb&gt;
    <representation>class java.lang.Object&lt;/representation&gt;
    <request>SOURCE active:httpPost+nvp@pbv%3Anvp+state@active%3AhttpState%2Bid%40F8FA009B28D26348A7ACCA46B054CB41+url@http%3A//fuseki-on-1270%3A3030/$/datasets/archive as Object&lt;/request&gt;
  &lt;/ex&gt;
  <ex>
    <id>SubrequestException&lt;/id&gt;
    <spaceHash>LT/B&lt;/spaceHash&gt;
    <space>HTTP Client Library (private)&lt;/space&gt;
    <endpoint>HttpClientAccessor&lt;/endpoint&gt;
    <endpointHash>LT/B/FJ&lt;/endpointHash&gt;
    <logicalEndpointHash>LT/B/httpClient.httpPost&lt;/logicalEndpointHash&gt;
    <logicalEndpoint>httpClient.httpPost&lt;/logicalEndpoint&gt;
    <ex>
      <id>org.apache.http.NoHttpResponseException&lt;/id&gt;
      <message>fuseki-on-1270:3030 failed to respond&lt;/message&gt;
      <stack>
        <level>org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead() line:143&lt;/level&gt;
        <level>org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead() line:57&lt;/level&gt;
        <level>org.apache.http.impl.io.AbstractMessageParser.parse() line:260&lt;/level&gt;
        <level>org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader() line:161&lt;/level&gt;
        <level>sun.reflect.NativeMethodAccessorImpl.invoke0() line:-2&lt;/level&gt;
        <level>sun.reflect.NativeMethodAccessorImpl.invoke() line:57&lt;/level&gt;
        <level>sun.reflect.DelegatingMethodAccessorImpl.invoke() line:43&lt;/level&gt;
        <level>java.lang.reflect.Method.invoke() line:606&lt;/level&gt;
        <level>org.apache.http.impl.conn.CPoolProxy.invoke() line:138&lt;/level&gt;
        <level>com.sun.proxy.$Proxy8.receiveResponseHeader() line:-1&lt;/level&gt;
        <level>... 69 more&lt;/level&gt;
      &lt;/stack&gt;
    &lt;/ex&gt;
  &lt;/ex&gt;
&lt;/ex&gt;

Moreover, no matter if it is the correct credentials, the exception still exists. If I turn off basic authentication of the remote service, then it works properly.

Has anybody encountered similar problem before? I think I have already checked all possible factors. I am looking forward to any hint or suggestion. Thank you very much and have a nice day.

Regards, Yang

Like · Post Reply