我尝试使用org.apache.poi和spring mvc生成word(.doc)文件。 但是发生了一个错误:
jetty ErrorLogMappingExceptionResolver Closed java.io.IOException: Closed")
当控制器返回时,单词(.doc)文件可以成功导出。
这个例外是在文件生成后的org.eclipse.jetty.server.HttpOutput.write()中,而jetty再次调用HttpOutput.write会导致异常吗?
相关代码:
HttpServletResponse response;
OutputStream outputStream = response.getOutputStream();
XWPFDocument xWPFDocument = new XWPFDocument();
xWPFDocument.write(outputStream);
outputStream.flush();
outputStream.close();
错误日志:
jetty ErrorLogMappingExceptionResolver Closed java.io.IOException: Closed
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140) ~[jetty-all-8.1.10.v20130312.jar:8.1.10.v20130312]
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:107) ~[jetty-all-8.1.10.v20130312.jar:8.1.10.v20130312]
at com.opensymphony.module.sitemesh.filter.RoutableServletOutputStream.write(RoutableServletOutputStream.java:118) ~[sitemesh-2.4.2.jar:?]
at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:2085) ~[jackson-core-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush(UTF8JsonGenerator.java:1097) ~[jackson-core-2.9.3.jar:2.9.3]
at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:915) ~[jackson-databind-2.9.3.jar:2.9.3]