简体   繁体   English

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

[英]Spring boot stomp server gives warning for resolved org.springframework.http.converter.HttpMessageNotWritableException

I have been working with spring boot and stomp server for sometime now.我一直在使用 spring 启动和踩踏服务器一段时间。 After using it for sometime I found that my logs are filled with the following waring messages.使用一段时间后,我发现我的日志中充满了以下警告消息。

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'],

To investigate further what is happening I set spring framework logging to TRACE and the rest of the log is given below.为了进一步调查发生了什么,我将 spring 框架日志记录设置为TRACE ,日志的 rest 如下所示。

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,

Looking at the logs I can see that before the server could send the frame a["\n"] to the client, the client has already disconnected and trying to send the frame to closed socket is causing the error.查看日志我可以看到,在服务器可以将帧a["\n"]发送到客户端之前,客户端已经断开连接并尝试将帧发送到关闭的套接字导致错误。 Is there any proper way to handle this error?有什么合适的方法来处理这个错误吗?

The server seems to want to write a LinkedHashMap as application/javascript;charset=UTF-8 and cannot find a converter to do so.服务器似乎想将LinkedHashMap编写为application/javascript;charset=UTF-8并且找不到转换器来执行此操作。 Which makes sense.这是有道理的。

I guess the return type (probably mime-type here but could be java type) is wrong.我猜返回类型(这里可能是 mime 类型,但可能是 java 类型)是错误的。 We would need a look at your endpoint to give a better answer on how to fix this.我们需要查看您的端点,以便就如何解决此问题给出更好的答案。

I have same problem.我有同样的问题。 you got it fix problem?你得到它解决问题?

暂无
暂无

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

相关问题 Elasticsearch“ org.springframework.http.converter.HttpMessageNotWritableException” - Elasticsearch “org.springframework.http.converter.HttpMessageNotWritableException” org.springframework.http.converter.HttpMessageNotWritableException:在corda中 - org.springframework.http.converter.HttpMessageNotWritableException: in corda 无法写入HTTP消息:org.springframework.http.converter.HttpMessageNotWritableException: - Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: 得到一个异常 org.springframework.http.converter.HttpMessageNotWritableException - getting a exception org.springframework.http.converter.HttpMessageNotWritableException Spring 一对多关系抛出异常:org.springframework.http.converter.HttpMessageNotWritableException - Spring One-To-Many relationship throws Exception : org.springframework.http.converter.HttpMessageNotWritableException spring MVC org.springframework.http.converter.HttpMessageNotWritableException:未找到类型为java.util.ArrayList的返回值的转换器 - spring MVC org.springframework.http.converter.HttpMessageNotWritableException: No converter found for return value of type: class java.util.ArrayList spring-cloud-schema-registry-client 没有转换为 Avro,我得到 org.springframework.http.converter.HttpMessageNotWritableException - spring-cloud-schema-registry-client does not convert to Avro and I get org.springframework.http.converter.HttpMessageNotWritableException org.springframework.http.converter.HttpMessageNotWritableException 没有找到类型的返回值的转换器:class - org.springframework.http.converter.HttpMessageNotWritableException No converter found for return value of type: class 无法写入HTTP消息:org.springframework.http.converter.HttpMessageNotWritableException:无法写入JSON:错误 - Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Error org.springframework.http.converter.HttpMessageNotWritableException:无法写入 JSON :(是 javaer.uLangException); 嵌套异常是 - org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: (was java.lang.NullPointerException); nested exception is
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM