Jersey Client POST results in - header full: java.lang.RuntimeException: Header>6144 Jersey Client POST results in - header full: java.lang.RuntimeException: Header>6144 json json

Jersey Client POST results in - header full: java.lang.RuntimeException: Header>6144


The error about header full: java.lang.RuntimeException: Header>6144 means that your response header was over 6144 bytes in size. The header capacity was at 6144 bytes and your generated header exceeded it.

Why 6144? well, that's calculated based on your Buffers implementation.

What Buffers implementation are you using? That is determined by the Connector you are using.

You can set your AbstractConnector.setResponseHeaderSize(int) to something larger for yourself.

If you are using standalone Jetty, modify your etc/jetty.xml to have the following ...

...<Call name="addConnector">  <Arg>      <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">        ...        <Set name="responseHeaderSize">10000</Set>        ...      </New>  </Arg></Call>...

This is a quick and dirty fix for your situation.

I encourage you to find out why you have a response header that size! That's not normal and could indicate that you have a much wider and fundamental issue.

Capture the entire HTTP transaction request + response, use wireshark to capture the traffic between jersey-client and the server.

Note: it might not be possible to see this bad response header from the specific call you are making, as Jetty will fail to generate the header (hence the error) and falls back to a default 500 error response. Once you increase your responseHeaderSize it might start generating properly, at which point you can capture and look at it.