今天在作SSH項目的時候,出現了這個錯誤。百思不得其解,網上的答案都不能解決個人問題…..java
後來,一氣之下就從新寫,寫了以後發如今JSP遍歷集合的時候出錯了。apache
<s:iterator value="rolePrivilegeSet"> <s:property value="#privilegeMap[compositeKey.code]"/> </s:iterator>
最後發現是Hibernate懶加載的問題,在配置文件中設置不懶加載,就解決掉這個問題了。tomcat
Struts Problem Report Struts has detected an unhandled exception: Messages: Stream closed File: org/apache/jasper/runtime/JspWriterImpl.java Line number: 210 Stacktraces java.io.IOException: Stream closed org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:210) org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115) org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java:177) org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:915) org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:656) org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:132) org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:188) com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:369) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:273) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:244) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) org.apache.catalina.core.StandardContextValve.__invoke(StandardContextValve.java:161) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:550) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:380) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:288) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) java.lang.Thread.run(Thread.java:722)
二次更新:
我把getContextMap()換成是getApplicatoin(),也會出現這樣的錯誤….markdown
ActionContext.getContext().getContextMap().put("privilegeMap", Constant.PRIVILEGE_MAP);
留意域對象有沒有錯誤!app