简体   繁体   English

带有 Stomp 的 Spring Boot 会给出 HttpMessageNotWritableException

[英]Spring boot with Stomp gives HttpMessageNotWritableException

I have been using spring boot with stomp server for websocket with sockjs as frontend library.我一直在使用带有 stomp 服务器的 spring boot 和 sockjs 作为前端库的 websocket。 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.但是这些数据是通过 websocket 进入的,所有数据都是使用来自前端的JSON.Stringify进行字符串处理,并由@MessageMapping注释控制器接收。 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.我使用 ActiveMQ 作为消息代理。

Can someone throw some light into what could be happening here.有人可以对这里可能发生的事情有所了解。

I figured out the issue myself.我自己弄清楚了这个问题。 Issue occurs when the stomp server try to send heart beat from server to client.当 stomp 服务器尝试将心跳从服务器发送到客户端时,会出现问题。 If the client disconnects while the server is sending the heartbeat, the issue occurs.如果客户端在服务器发送心跳时断开连接,则会出现此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring 启动 stomp 服务器对已解决的 org.springframework.http.converter.HttpMessageNotWritableException 发出警告 - Spring boot stomp server gives warning for resolved org.springframework.http.converter.HttpMessageNotWritableException 如何在春季启动时在oneToMany中修复HttpMessageNotWritableException - How to fix HttpMessageNotWritableException in oneToMany in Spring boot 在Tomcat上部署Spring Boot + WebSocket + Stomp - Deploy Spring Boot + WebSocket + Stomp on Tomcat Spring Boot - Stomp:'。' 消息目标中的vs'/' - Spring Boot - Stomp : '.' vs '/' in Message Destination 从 spring boot stomp 连接到外部 activemq - Connect to external activemq from spring boot stomp 在 stomp websocket spring boot 2 中自定义错误消息 - Customize error message in stomp websocket spring boot 2 Spring Boot WebSockets处理STOMP消息 - Spring boot websockets handling STOMP messages JAX RS 和 WebSockets 与 Spring Boot 中的 Stomp 冲突 - JAX RS and WebSockets with Stomp in Spring Boot conflict 春季启动:失败..写HTTP消息:springframework.http.converter.HttpMessageNotWritableException - Spring Boot: Failed .. write HTTP message: springframework.http.converter.HttpMessageNotWritableException Spring Boot + Spring Web Socket + RabbitMQ Web STOMP - Spring Boot + Spring Web Socket + RabbitMQ Web STOMP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM