首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Spring启动stomp服务器对解析的org.springframework.http.converter.HttpMessageNotWritableException发出警告

Spring启动stomp服务器对解析的org.springframework.http.converter.HttpMessageNotWritableException发出警告
EN

Stack Overflow用户
提问于 2022-05-30 13:21:09
回答 1查看 359关注 0票数 0

到目前为止,我一直在使用spring启动和stomp服务器。使用它一段时间后,我发现我的日志中充满了下面的警告消息。

代码语言:javascript
复制
08:58:36.026 [38] [http-nio-8080-exec-8] 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'],

为了进一步了解正在发生的事情,我将spring框架日志设置为TRACE,日志的其余部分如下所示。

代码语言:javascript
复制
08:58:35.991 [94] [clientOutboundChannel-14] TRACE org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession - 1 message(s) to flush in session d3zz_wqj,
08:58:35.991 [94] [clientOutboundChannel-14] TRACE org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession - Session is active, ready to flush.,
08:58:35.991 [94] [clientOutboundChannel-14] TRACE org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession - Preparing to write SockJsFrame content='a[\"\\n\"]',
08:58:35.991 [94] [clientOutboundChannel-14] TRACE org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession - Writing to HTTP response: a[\"\\n\"],
08:58:35.992 [94] [clientOutboundChannel-14] TRACE org.springframework.web.socket.sockjs.DisconnectedClient - Looks like the client has gone away,
08:58:35.994 [94] [clientOutboundChannel-14] DEBUG org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler$XhrStreamingSockJsSession - Closing SockJS session d3zz_wqj with CloseStatus[code=1011, reason=null],
08:58:35.994 [94] [clientOutboundChannel-14] DEBUG org.springframework.web.socket.handler.LoggingWebSocketHandlerDecorator - XhrStreamingSockJsSession[id=d3zz_wqj] closed with CloseStatus[code=1011, reason=null],
08:58:35.994 [94] [clientOutboundChannel-14] DEBUG org.springframework.web.socket.messaging.SubProtocolWebSocketHandler - Clearing session d3zz_wqj,
08:58:35.994 [94] [clientOutboundChannel-14] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'getTracer',
08:58:35.994 [102] [clientInboundChannel-21] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'getTracer',
08:58:35.994 [94] [clientOutboundChannel-14] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'getTracer',
08:58:35.994 [100] [clientInboundChannel-19] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'getTracer',
08:58:35.994 [94] [clientOutboundChannel-14] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'getTracer',
08:58:35.994 [103] [clientInboundChannel-22] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'getTracer',
08:58:35.994 [103] [clientInboundChannel-22] DEBUG org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler - Forwarding DISCONNECT session=d3zz_wqj,
08:58:35.994 [103] [clientInboundChannel-22] TRACE org.springframework.messaging.simp.stomp.StompEncoder - Encoding STOMP DISCONNECT, headers=null,
08:58:35.996 [46] [tcp-client-loop-nio-4] DEBUG org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler - Cleaning up connection state for session d3zz_wqj,
08:58:35.996 [46] [tcp-client-loop-nio-4] DEBUG org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler - Closing TCP connection in session d3zz_wqj,
08:58:35.998 [94] [clientOutboundChannel-14] DEBUG org.springframework.web.socket.messaging.StompSubProtocolHandler - Failed to send WebSocket message to client in session d3zz_wqj,
08:58:36.005 [38] [http-nio-8080-exec-8] TRACE org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter - Bound request context to thread: org.apache.catalina.core.ApplicationHttpRequest@2f4e2263",
08:58:36.005 [38] [http-nio-8080-exec-8] TRACE org.springframework.web.servlet.DispatcherServlet - \"INCLUDE\" dispatch for POST \"/socket/error\", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet',
08:58:36.010 [38] [http-nio-8080-exec-8] TRACE org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - 2 matching mappings: [{ [/error]}, { [/error], produces [text/html]}],
08:58:36.010 [38] [http-nio-8080-exec-8] TRACE org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'basicErrorController',
08:58:36.010 [38] [http-nio-8080-exec-8] TRACE org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest),
08:58:36.018 [38] [http-nio-8080-exec-8] TRACE org.springframework.web.method.HandlerMethod - Arguments: [org.apache.catalina.core.ApplicationHttpRequest@2f4e2263],
08:58:36.021 [38] [http-nio-8080-exec-8] DEBUG org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor - Found 'Content-Type:application/javascript;charset=UTF-8' in response,
08:58:36.022 [38] [http-nio-8080-exec-8] TRACE org.springframework.web.method.HandlerMethod - Error handling return value=[<200 OK OK,{timestamp=Fri May 27 08:58:36 UTC 2022, status=200, error=OK, path=/socket/ws/067/d3zz_wqj/xhr_streaming},[]>], type=org.springframework.http.ResponseEntity in org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest),
08:58:36.026 [38] [http-nio-8080-exec-8] 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'],
08:58:36.026 [38] [http-nio-8080-exec-8] TRACE org.springframework.web.servlet.DispatcherServlet - No view rendering, null ModelAndView returned.,
08:58:36.027 [38] [http-nio-8080-exec-8] DEBUG org.springframework.web.servlet.DispatcherServlet - Exiting from \"INCLUDE\" dispatch, status 200, headers={masked},
08:58:36.027 [38] [http-nio-8080-exec-8] TRACE org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter - Cleared thread-bound request context: org.apache.catalina.core.ApplicationHttpRequest@2f4e2263,

查看日志,我可以看到,在服务器将框架a["\n"]发送到客户端之前,客户端已经断开连接,试图将帧发送到关闭的套接字将导致错误。有什么正确的方法来处理这个错误吗?

EN

回答 1

Stack Overflow用户

发布于 2022-05-30 13:35:04

服务器似乎希望将LinkedHashMap编写为application/javascript;charset=UTF-8,但无法找到转换器。这很有道理。

我想返回类型(这里可能是mime类型,但可能是java类型)是错误的。我们需要查看您的端点,以便更好地回答如何解决这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72435036

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档