1

How could I solve this in my spring web application? It is working in JDK 1.7, Spring 4.1.3 RELEASE and WebLogic 10 but when we upgrade JDK 1.8 , Spring 4.1.3 RELEASE and Weblogic 12.2 it is failing. can we increase header size in RestTemplate. Please let me know

Please find below error

**<h1>Bad Message 431</h1><pre>reason: Request Header Fields Too Large</pre>"
2020-11-10 12:06:05.574 headers [DEBUG] http-outgoing-0 << HTTP/1.1 431 Request Header Fields Too Large
2020-11-10 12:06:05.574 headers [DEBUG] http-outgoing-0 << Content-Type: text/html;charset=iso-8859-1
2020-11-10 12:06:05.574 headers [DEBUG] http-outgoing-0 << Content-Length: 74
2020-11-10 12:06:05.590 headers [DEBUG] http-outgoing-0 << nnCoection: close
2020-11-10 12:06:05.590 MainClientExec [DEBUG] Connection can be kept alive indefinitely
2020-11-10 12:06:05.590 PoolingHttpClientConnectionManager [DEBUG] Connection [id: 0][route: {s}-> can be kept alive indefinitely
2020-11-10 12:06:05.590 DefaultManagedHttpClientConnection [DEBUG] http-outgoing-0: set socket timeout to 0
2020-11-10 12:06:05.590 PoolingHttpClientConnectionManager [DEBUG] Connection released: [id: 0][route: {s}->][total kept alive: 1; route allocated: 1 of 2; total allocated: 1 of 20]
2020-11-10 12:06:05.605 ServiceImpl [ERROR] ValidateToken Service failed with this exception: <h1>Bad Message 431</h1><pre>reason: Request Header Fields Too Large</pre>
2020-11-10 12:06:05.637 ExceptionControllerAdvice [ERROR] Unhandled exception.
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at com.agreement.rest.domain.Exception.fromJsonToException(Exception.java:78)**
M. Deinum
  • 115,695
  • 22
  • 220
  • 224
prakash sanap
  • 11
  • 1
  • 1
  • 3
  • You get an error from the server, so even if yu could, the server would fai. – M. Deinum Dec 22 '20 at 08:19
  • we are using weblogic12 can we increase on server side – prakash sanap Dec 22 '20 at 08:30
  • Not your server, the server that the other application is running on. Also you might want to check the headers as you are sending large headers, which isprobably the fault already. Sending too many cookies or a too large Refer header for instance. – M. Deinum Dec 22 '20 at 09:49
  • Thanks for your reply Deinum . It is working in JDK 1.7 , Spring 4.1.3 RELEASE and WebLogic 10 but failing in JDK 1.8 ,Spring 4.1.3 RELEASE and Weblogic12 this is redirect URL we are sending token which is big we want to send this token as per project requirement – prakash sanap Dec 22 '20 at 11:51
  • Now that is a crucial piece of information that you decided to leave out of the question. Please add that but to the question. You nowhere mention that it was working before the upgrade!. – M. Deinum Dec 22 '20 at 12:35
  • Modified the question Please let me know how we can increase the header size in spring 4 or in Weblogic – prakash sanap Dec 23 '20 at 06:56
  • As mentioned you don't. It is something on the server that is blocking this **not** the template. So you need to configure something in weblogic not your app. Could be a different encoding (using UTF would double the size), maybe something gets added, maybe there are even more headers on WebLogic 12 as compared to WebLogic 10. Debug and figure those things out then configure weblogic accordingly. – M. Deinum Dec 23 '20 at 07:59

1 Answers1

0

I have resolved this using HTTPURLConnection

prakash sanap
  • 11
  • 1
  • 1
  • 3