Skip to content
Advertisement

Spring boot with Stomp gives HttpMessageNotWritableException

I have been using spring boot with stomp server for websocket with sockjs as frontend library. Intermittently I get the following message in the logs.

11:10:15.017 [37] [http-nio-8080-exec-7] WARN  org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolved [org.springframework.http.converter.HttpMessageNotWritableException: No converter for [class java.util.LinkedHashMap] with preset Content-Type 'application/javascript;charset=UTF-8']

As far as I have read this occurs when wrong content type is recieved in controller. But this data comes in through websocket and all the data is made to string using JSON.Stringify from frontend and recieved by @MessageMapping annoted controller. Iam not able to understand why this error occurs , could there be other reasons for this issue to occur. I have used ActiveMQ as the message broker.

Can someone throw some light into what could be happening here.

Advertisement

Answer

I figured out the issue myself. Issue occurs when the stomp server try to send heart beat from server to client. If the client disconnects while the server is sending the heartbeat, the issue occurs.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement