`

out.print(); 线程异常

阅读更多
引用
严重: Servlet.service() for servlet jsp threw exception
java.io.IOException: Stream closed
at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:188)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:77)
at org.apache.jsp.heen_005fadd_jsp._jspService(heen_005fadd_jsp.java:686)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.grxxh.filter.EncodingFilter.doFilter(EncodingFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.grxxh.filter.EncodingFilter.doFilter(EncodingFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.grxxh.filter.SessionFilter.doFilter(SessionFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
org.apache.jasper.JasperException: java.lang.IllegalStateException: Exception occurred when flushing data
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:413)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1054)
at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.grxxh.filter.EncodingFilter.doFilter(EncodingFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.grxxh.filter.EncodingFilter.doFilter(EncodingFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.grxxh.filter.SessionFilter.doFilter(SessionFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Exception occurred when flushing data
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:77)
at org.apache.jsp.heen_005fadd_jsp._jspService(heen_005fadd_jsp.java:686)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
... 37 more
Caused by: java.io.IOException: Stream closed
at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:188)
... 43 more


解决办法: jsp 页面的 out.print();  换成  if(true){return}

原因我也没想明白,关于线程冲突的异常。有时间研究下
分享到:
评论

相关推荐

    SCJP Braindump SCJP 题库 SCJP 考题

    - SCJP考试覆盖了Java编程的核心概念和技术,包括但不限于类的设计、异常处理、线程管理、集合框架等。 #### SCJP轻松过 - 学习指南与题库分析 ### 代码示例解析 #### 示例1: 类继承与方法重写 ```java class ...

    tomcat输出输出着就不输出了,什么原因?解决方法是

    如果线程池配置不当,比如最大线程数限制过小,当达到上限时,新的请求将无法处理,可能导致看似程序停止输出的现象。检查`server.xml`中的`Executor`元素配置。 4. **Spring生命周期管理**:你提到将方法托管给...

    oracle认证的java考试(19)

    System.out.println("算术运算异常:" + exc1.getMessage()); } catch (ArrayIndexOutOfBoundsException exc2) { System.out.println("数据越界异常:" + exc2.getMessage()); } ``` - **finally**:无论是否发生...

    java面试进阶讲义

    如果在一个线程中抛出异常,另一个线程不会捕获到这个异常。 - **解决方案**:可以通过线程的 `uncaughtExceptionHandler` 来处理未捕获的异常。 ##### 11、闭包 - **定义**:闭包是指一个函数及其相关的引用环境...

    2013 sun SCJP 认证题库

    SCJP认证考试覆盖了Java Standard Edition 6 (Java SE 6) 的核心概念和技术,包括语法、面向对象编程、集合框架、异常处理、线程、输入/输出流、泛型、注解等。 ### 题库信息 2013年的SCJP考试题库主要包含了针对...

    java面试题

    System.out.print("1"); } public A() { System.out.print("2"); } } public class B extends A { static { System.out.print("a"); } public B() { System.out.print("b"); } } public class ...

    Java开发工程师笔试题带答案.pdf

    本题为Java开发工程师的笔试题目,主要考察了编程题和选择题两大部分,涵盖排序算法、算术运算、序列化、类与对象、变量类型、构造方法、关键字super、设计模式、异常处理以及多线程等核心Java知识。 1. **编程题**...

    多线程异常处理.pdf

    在上述实验代码中,当打印"A"或"B"时,使用了try-catch结构来处理可能的异常,如`System.out.print()`可能会抛出的`IOException`。如果出现异常,程序会执行catch块内的`e.printStackTrace()`,打印出异常堆栈跟踪...

    Java考试必备基础练习题.pdf

    3. **JVM的特性**:Java虚拟机的特性包括异常处理、多线程和动态链接。选项D的"简单易学"并不直接属于JVM的执行特点。 4. **Java语言特点**:Java是分布式、安全的、面向对象的语言,并且是解释执行(编译成字节码...

    异常处理和多线程

    System.out.print((char) b); } in.close(); } catch (FileNotFoundException e) { System.out.println("File not found: " + e.getMessage()); } catch (IOException e) { System.out.println("I/O error: ...

    JAVA编程题习题(附答案).docx

    System.out.print("请输入第二个正整数:"); int n = s.nextInt(); int gcd = findGCD(m, n); int lcm = (m * n) / gcd; System.out.println("最大公约数是:" + gcd); System.out.println("最小公倍数是:" + ...

    java调用本地打印机

    除了上述基本流程,Java打印API还支持更高级的功能,比如打印预览、多页文档处理、处理打印异常等。在实际项目中,可能还需要考虑线程安全、错误处理以及用户交互等复杂情况。 此外,如果需要处理PDF、图像或其他...

    java多线程进度条实例

    这个实例提供了一个基础的进度条实现,但在实际应用中,可能需要考虑更多因素,如线程优先级、线程池的使用、异常处理、线程间的通信等。此外,如果是在图形用户界面环境下,还需要考虑UI更新的流畅性和用户体验。...

    java 打印出所有的水仙花数

    3. **输入输出操作**:System.out.print()用于输出结果。 #### 三、代码分析 根据提供的代码片段,我们可以详细分析其中的关键逻辑和步骤: ```java public class NarcissisticNumber { public static void main...

    java经典习题与答案

    if ((a = false) | (a & c)) | (a | b)) System.out.print("B"); } } ``` - 结果为:**(B)B** - **解析**:第一个`if`语句中的条件不成立,因此不会输出“A”。第二个`if`语句中的条件为真,因为`a`被赋值为`...

    java孔维艳.pdf

    Java编程基础知识点详解 在Java编程中,基础知识是学习任何高级概念的基础。...通过不断的实践和学习,可以逐步掌握Java的高级特性,如面向对象编程、异常处理、集合框架、多线程等,从而成为一位熟练的Java开发者。

    PrintSpooler.docx

    在多线程环境下,多个线程可能同时进入`getInstance()`方法的判断,导致创建多个实例,违背了单例模式的设计初衷。 为了解决这个问题,可以采用"双重检查锁定"(Double-Checked Locking)的策略。在`getInstance()`...

    Java语言程序设计(第2版)第1-6章-课后习题答案.doc

    - **解释**:`System.out.print`用于输出不换行的文本,而`System.out.println`用于输出换行的文本。 #### 2. 输入字符示例 ```java import java.io.*; public class Exerl_2 { public static void main(String[]...

    100-ways-to-print-HelloWorld-in-java-master_helloworld_

    System.out.print(part); } System.out.println(); } } ``` 这里我们还可以看到如何使用数组和for循环,这是编程中常见的控制流结构。 更进一步,可以涉及反射API,虽然这在实际应用中并不常见,但对于理解...

    Java线程:线程状态的转换

    System.out.print("线程睡眠1毫秒!"); } catch (InterruptedException e) { e.printStackTrace(); } } } public static void main(String[] args) { new MyThread().start(); } } ``` 这段代码中,`...

Global site tag (gtag.js) - Google Analytics