0

我们使用 @Push(transport = Transport.WEBSOCKET_XHR) 启用了 Vaadin Push。当 UI 分离时,我们在日志中看到以下异常。

似乎它不会影响日志中的错误以外的任何内容。你知道如何很好地关闭连接,这样我们就不会用这些错误填充日志吗?

先感谢您。

07:33:40.853 [http-nio-8080-exec-7] ERROR o.a.container.JSR356Endpoint/log
java.io.IOException: Unable to write the complete message as the WebSocket connection has been closed
        at org.apache.tomcat.websocket.WsSession.registerFuture(WsSession.java:664)
        at org.apache.tomcat.websocket.FutureToSendHandler.get(FutureToSendHandler.java:92)
        at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.startMessageBlock(WsRemoteEndpointImplBase.java:277)
        at org.apache.tomcat.websocket.WsSession.sendCloseMessage(WsSession.java:586)
        at org.apache.tomcat.websocket.WsSession.doClose(WsSession.java:488)
        at org.apache.tomcat.websocket.WsSession.close(WsSession.java:455)
        at org.apache.tomcat.websocket.WsSession.close(WsSession.java:449)
        at org.atmosphere.container.version.JSR356WebSocket.close(JSR356WebSocket.java:142)
        at org.atmosphere.cpr.AtmosphereResourceImpl.close(AtmosphereResourceImpl.java:860)
        at com.vaadin.server.communication.ArePushConnection.disconnect(AtmospherePushConnection.java:312)
        at com.basf.gb.cube.seq.vaadinui.MyVaadinUI.detach(MyVaadinUI.java:111)
        at com.vaadin.ui.UI.setSession(UI.java:465)
        at com.vaadin.server.VaadinSession.removeUI(VaadinSession.java:870)
        at com.vaadin.server.VaadinService$1$1.run(VaadinService.java:481)
        at com.vaadin.ui.UI.accessSynchronously(UI.java:1381)
        at com.vaadin.server.VaadinService$1.run(VaadinService.java:469)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at com.vaadin.server.VaadinService.runPendingAccessTasks(VaadinService.java:1835)
        at com.vaadin.server.VaadinSession.unlock(VaadinSession.java:990)
        at com.vaadin.server.VaadinService.requestEnd(VaadinService.java:1356)
        at org.vaadin.spring.servlet.Vaadin4SpringServletService.requestEnd(Vaadin4SpringServletService.java:84)
        at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1423)
        at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:364)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextHeaderFilter.doFilterInternal(EndpointWebMvcAutoConfiguration.java:237)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(AppliclterChain.java:207)
        at org.vaadin.spring.http.HttpResponseFilter.doFilter(HttpResponseFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.security.oauth2.client.filter.OAuth2ClientContextFilter.doFilter(OAuth2ClientContextFilter.java:60)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:112)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChaiter(FilterChainProxy.java:330)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:103)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
07:33:41.209 [http-nio-8080-exec-7] DEBUG c.vaadin.spring.internal.UIScopeImpl/detach UI [com.basf.gb.cube.seq.vaadinui.MyVaadinUI@a27a41e] has been detached, destroying [UIBeanStore
[id=4df03526, name=UI:0]]
07:33:41.210 [http-nio-8080-exec-7] DEBUG com.vaadin.spring.internal.BeanStore/destroy Destroying [UIBeanStore[id=4df03526, name=UI:0]]
07:33:41.211 [http-nio-8080-exec-7] DEBUG c.v.s.internal.UIScopeImpl$UIStore/sessionDestroy Vaadin session has been destroyed, destroying [UIStore[id=36f84595, sessionId=55AF0F6E983B
2291A8F9DBE9AA370163]]
07:33:41.212 [http-nio-8080-exec-7] DEBUG c.v.s.i.VaadinSessionScope$SessionAwareBeanStore/sessionDestroy Vaadin session has been destroyed, destroying [SessionAwareBeanStore[id=6275
7279, name=Session:55AF0F6E983B2291A8F9DBE9AA370163]]
4

2 回答 2

2

这是一个 Tomcat 错误,请参阅https://bz.apache.org/bugzilla/show_bug.cgi?id=59014

请升级到 Tomcat 版本 8.0.33 或 7.0.69

于 2016-03-30T08:46:07.723 回答
0

亚历山大的回答是正确的。您需要升级 8.0.33 来解决这个问题,这就是我设法更改 Spring Boot 和 Gradle 的 Tomcat 版本的方法。

  compile("org.springframework.boot:spring-boot-starter-web") {
    exclude module: "spring-boot-starter-tomcat"
  }
  //Because of the websocket defect on tomcat, I comment out the below line 
  //providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
  compile 'org.apache.tomcat.embed:tomcat-embed-core:8.0.33'
  compile 'org.apache.tomcat.embed:tomcat-embed-el:8.0.33'
  compile 'org.apache.tomcat.embed:tomcat-embed-logging-juli:8.0.33'
  compile 'org.apache.tomcat.embed:tomcat-embed-websocket:8.0.33'
于 2016-03-31T01:52:02.783 回答