getWriter() has already been called for this response

今天直接组合开源分布式工具zookeeper,其中有个下载功能,可以下载成功,但就是后台一直抛出很多错误,org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: getWriter() has already been called for this response,看的很不爽,


网上说了加上flush,加上reset,out.clear();  out = pageContext.pushBody();  但就是不行,之后想着写个过滤器,之后在过滤器里面抓取异常,用log4j打印下getMessage信息,这样就好看多了,效果图:



但还是有点不爽,之后看到,之后在网上看到一种情况说getWriter和getOutputStream不能同时使用,但检查自己的方法就用了getWriter啊,之后想是不是调用的jar包里面用了getOutputStream,根据错误信息一查,还真用了,之后改成这样,就不报错了





猜你喜欢

转载自blog.csdn.net/xionglangs/article/details/76336200
今日推荐