Spring what is between Controller and Interceptor - spring

I have a controller that is doing something, everything seems fine, it logs a success, and then it does this
return new ResponseEntity<>(resp, HttpStatus.OK);
Seems like it should send a 200 OK.
Well, I also have a HandlerInterceptorAdapter with an "afterCompletion" that logs the status:
logger.debug("Response status: {}, URI: {}", response.getStatus(), request.getRequestURI());
This is showing a 500 where there was a success from the controller.
In the stdout logs I see an error
2018-01-12 12:33:59.035 ERROR 18952 --- [pr-8080-exec-14] o.s.boot.web.support.ErrorPageFilter : Cannot forward to error page for request [/ws/path] as the response has already been committed.
As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
and
org.apache.catalina.connector.ClientAbortException: java.io.IOException: APR error: -32
I can't find any doc on what that APR error is and I have no idea why the status code would be wrong. I am using tomcat 8.5.

So. APR -32 is a "Client Abort" error. The client was timing out in waiting. It looks like what was happening was the client made a request and was sitting in queue for a few seconds. It has a short hard timeout limit. The client timed out before the server got to the request. Then the server picked up the request and did everything fine but when trying to write back to the client, it found the socket closed. So it set a 500 and threw that exception.

Related

JMeter response 504 Gateway time-out?

I am trying to perform a test against an endpoint with 1 thread. I configured a HTTP request with JSON Monk endpoint URL using JMEter.
But when I run the test I get Response code:504 in the Sampler result. The same when I use the URL in a browser I get also 504 Gateway Time-out
Can anyone help me with this issue? - I tried in another pc and I got the same error!
I have installed JMeter correctly and my code is correct too. I am working on a Windows 10.
HTTP Request:
As per HTTP Status Code 504 description
The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.
Note: A Gateway might refer to different things in networking and a 504 error is usually not something you can fix, but requires a fix by the web server or the proxies you are trying to get access through.
So it indicates the problem with the server you're trying to test, if you own the website - go and fix it, if you know someone who is responsible for it - inform him/her/them.
There is nothing you can do from JMeter perspective. If you know how response should look like you can use a Dummy Sampler to return this response so you could play with the response data
By the way, it's down for me as well:

wso2ei 6.4 - Return HTTP/1.1 202 Accepted

We are migrating services from WSO2 ESB 4.7 to WSO2 EI 6.4.
The problem is that when we call a ESB soap 1.1 service this is executed correctly but the client (SoapUI in this case) receives a response code 202 with content-lenght 0 (status: HTTP/1.1 202 Accepted).
In carbon log we find this record: [SynapseWorker-2] WARN {org.apache.synapse.transport.passthru.PassThroughHttpSender} - Trying to submit a response to an already closed connection : http-incoming-1
The problem is not a timeout and if we change in SoapUI the content-type from request header we have a response with content-lenght > 0
Axis2 is configurated with text/xml enable both in Message Formatters and in Message Builders.
Any idea in order to address/solve the problem?
The message you're seeing: "Trying to submit a response to an already closed connection", could mean that the connection was closed by either the client or some operation inside your proxy/sequence. Are you handling the errors within the fault sequence?
I usually get unexpected 202 when there's something wrong with my service. It can be unhandled errors, not having <respond/> on the right place (like when using clone/iterate mediators without minding the threading behind these)...
My suggestion is to use logs and also debugging to see what happens before you get the 202 or the "Trying to submit a response to an already closed connection" message.

Websocket implementation not working in Apache Ofbiz

I am checking the Websocket implementation in Apache Ofbiz.
I followed the parent ticket OFBIZ-7073 and its child tickets.
But I am getting the following error-
ExamplePushNotifications.js:23 WebSocket connection to 'wss://localhost:8443/example/ws/pushNotifications' failed: Error during WebSocket handshake: Unexpected response code: 404
I think that the request is redirecting to control servlet rather than tomcat server. Therefore IMO, we need to make some changes in example/web.xml.
How should I proceed?
Thanks in advance!

REST service, always give 404 Context Root Not Found error for the first time request, then work well

In my REST service, once I start or restart my websphere application server and do a request at the first time, the response will return 404 Context Root Not Found error, after this, do requests on this REST service can work well.
The problem is that the 404 error is always return at my first request after my server start.
Could you give some suggestions?

Spring Rest Service getting 400 Bad Request after running 2-3 minutes

I have a rest client and server which we have developed using spring. The client will send requests to the server for 2-3 minutes and then starts getting org.springframework.web.client.HttpClientErrorException: 400 Bad Request errors.
Once the 400 error starts the client is unable to communicate with the server.
Any suggestions would be appreciated.
I will try to develop a working example that creates this error.
I have resolved this issue. The code was setting the following for every call:
// Add the Gson message converter
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());
I moved this code to the constructor and no longer getting the 400 Bad Request error.

Resources