Bluemix云代工java应用程序异常:OutputStream已经关闭

时间:2017-03-05 08:07:48

标签: java spring-mvc tomcat ibm-cloud

我的Java Web应用程序(使用Spring MVC)在Tomcat中运行良好,但在Bluemix Cloud Foundry上运行不正常。在每个HTTP请求之后,日志中存在以下消息,并且在方法调用之后不会返回响应:

异常:OutputStream已关闭

有什么想法吗?

日志文件:

3/5/2017 7:56:00 AM ERR APP [ERROR   ] SRVE0777E: Exception thrown by application class 'com.ibm.ws.http.channel.internal.outbound.HttpOutputStreamImpl.validate:210'
3/5/2017 7:56:00 AM ERR APP java.io.IOException: Stream is closed
3/5/2017 7:56:00 AM ERR APP at com.ibm.ws.http.channel.internal.outbound.HttpOutputStreamImpl.validate(HttpOutputStreamImpl.java:210)
3/5/2017 7:56:00 AM ERR APP at [internal classes]
3/5/2017 7:56:00 AM ERR APP at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:101)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMessageConverterMethodProcessor.java:231)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.handleReturnValue(RequestResponseBodyMethodProcessor.java:174)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:132)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
3/5/2017 7:56:00 AM ERR APP at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
3/5/2017 7:56:00 AM ERR APP at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
3/5/2017 7:56:00 AM ERR APP at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
3/5/2017 7:56:00 AM ERR APP at [internal classes]
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:215)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
3/5/2017 7:56:00 AM ERR APP at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
3/5/2017 7:56:00 AM ERR APP at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
3/5/2017 7:56:00 AM ERR APP at [internal classes]
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
3/5/2017 7:56:00 AM ERR APP at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
3/5/2017 7:56:00 AM ERR APP at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
3/5/2017 7:56:00 AM ERR APP at [internal classes]
3/5/2017 7:56:00 AM OUT APP [WARNING ] WARNING: Cannot set status. Response already committed.
3/5/2017 7:56:00 AM ERR APP [ERROR   ] Error Page Exception:
3/5/2017 7:56:00 AM ERR APP myapp
3/5/2017 7:56:00 AM ERR APP /
3/5/2017 7:56:00 AM ERR APP Error Page Exception
3/5/2017 7:56:00 AM ERR APP com.ibm.ws.webcontainer.webapp.WebAppErrorReport: java.io.IOException: Stream is closed
3/5/2017 7:56:00 AM ERR APP at com.ibm.ws.http.channel.internal.outbound.HttpOutputStreamImpl.validate(HttpOutputStreamImpl.java:210)
3/5/2017 7:56:00 AM ERR APP at [internal classes]
3/5/2017 7:56:00 AM ERR APP Caused by: java.io.IOException: Stream is closed
3/5/2017 7:56:00 AM ERR APP ... 3 more

1 个答案:

答案 0 :(得分:1)

如果您正在使用Tomcat进行本地开发,那么您应该在Bluemix上使用Tomcat。默认情况下,当您推送jar / war / ear时,将使用WebSphere Liberty buildpack。如果要使用Tomcat,请使用预先安装的java_buildpack buildpack,如下所示:

cf push MyAppName -p target/myapp.war -b java_buildpack

如果你正在使用manifest.yml文件:

---
applications:
 - name: MyAppName
   path: target/myapp.war
   buildpack: java_buildpack