cuiyi's blog(崔毅 crazycy)

记录点滴 鉴往事之得失 以资于发展
数据加载中……

苦不堪言,iReport + JasperReports项目中的历练(二)

1)  java.lang.InternalError: erroneous handlers
error like following
Servlet.service() for servlet action threw exception
java.lang.InternalError: erroneous handlers
    at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:
250)
    at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:
167)
    at com.justcommodity.cxc.jsp.reports.CxcReportBasedEnhSqlAction$$M$573fee08.write2Stream(CxcReportBasedEnhSqlAction.java:
161)
    at com.justcommodity.cxc.jsp.reports.CxcReportBasedEnhSqlAction$$M$573fee08.execute(CxcReportBasedEnhSqlAction.java:
62)
    at com.justcommodity.cxc.jsp.reports.CxcReportBasedEnhSqlAction$$A$573fee08.execute(
<generated>:0)
    at com.justcommodity.cxc.jsp.reports.CxcReportBasedEnhSqlAction.execute(
<generated>:0)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:
484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:
507)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
697)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
672)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
463)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:
398)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:
301)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
1069)
    at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:
455)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:
507)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
697)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)

just cause lacking some jar, like I used jasperreport.jar, but with no iText.jar, so the error happen

2) java.io.IOException: java.awt.Image fetch aborted or errored
error like following
java.io.IOException: java.awt.Image fetch aborted or errored
        at com.lowagie.text.Image.getInstance(Unknown Source)
        at com.lowagie.text.Image.getInstance(Unknown Source)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:
1075)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:
480)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:
448)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:
413)
        at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:
250)
        at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:
167)
        at com.justcommodity.cxc.jsp.reports.CxcReportBasedEnhSqlAction.write2Stream(CxcReportBasedEnhSqlAction.java:
164)
        at com.justcommodity.cxc.jsp.reports.CxcReportBasedEnhSqlAction.execute(CxcReportBasedEnhSqlAction.java:
69)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:
484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:
507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
697)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:
398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:
301)
        at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
1069)
        at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:
455)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:
507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
697)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)

You know, java can release resource, but it never catch the process of memory running;
So, while doing batch print, so you can open Is Cache & Is Delay, both the two options can make you sure using the pic only once, and read from cache later.

3) java.io.EOFException
12:06:47,612 ERROR [ReportAction]
  demo.jsp.reports.ReportException: java.io.EOFException
        at java.io.DataInputStream.readInt(DataInputStream.java:
358)
        at demo.jsp.reports.Report.throwAnyErrorFromChild(CxcReport.java:
664)
        at demo.jsp.reports.Report.writeReportToStream(CxcReport.java:
740)
        at demo.jsp.reports.ReportAction.execute(CxcReportAction.java:
110)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:
484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:
398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:
301)
        at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
1069)
        at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:
455)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:
292)
        at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:
116)
        at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:
79)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:
303)
        at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:
246)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:
303)
        at com.jc.cxc.web.filter.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:
171)
Caused by: java.io.EOFException
         
32 more
12:06:47,615 ERROR [ReportAction]
ClientAbortException:  java.net.SocketException: Write failed: Broken pipe
        at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:
327)
        at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:
293)
        at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:
97)
        at demo.jsp.reports.ReportAction.execute(ReportAction.java:
132)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:
484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:
398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:
301)
        at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
1069)
        at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:
455)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:
292)
        at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:
116)
        at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:
79)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:
303)
        at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:
246)
        at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:
303)
        at com.jc.cxc.web.filter.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:
171)
Caused by: java.net.SocketException: Write failed: Broken pipe
        at jrockit.net.SocketNativeIO.writeBytesPinned(Native Method)
        at jrockit.net.SocketNativeIO.socketWrite(Unknown Source)
        at java.net.SocketOutputStream.socketWrite0(SocketOutputStream.java)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:
92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:
136)
        at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:
746)
        at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:
433)
        at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:
304)
        at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:
991)
        at org.apache.coyote.Response.action(Response.java:
182)
        at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:
322)
        at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:
293)
        at org.apache.catalina.connector.CoyoteOutputStream.flush(CoyoteOutputStream.java:
97)
        at com.justcommodity.cxc.jsp.reports.CxcReportAction.execute(CxcReportAction.java:
132)
        at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:
484)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
274)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:
398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:
301)
        at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
1069)
        at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:
455)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:
525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
717)
  测试了所有能排除的问题,最后解决了,绝对不解释,哈哈
另外把java.io.EOFException查找到比较好的资料帖过来:
------------------转-start-----------------
摘自http://xiao-yi.javaeye.com/blog/151120
摘自http://blog.csdn.net/fengzi1/archive/2008/01/30/2073433.aspx

ClientAbortException,java.net.SocketException.
关键字: Tomcat ClientAbortException
TOMCAT报异常,如下:

引用
java.lang.RuntimeException: javax.xml.transform.TransformerException: ClientAbortException: java.net.SocketException: Software caused connection abort: socket write error
at org.ajaxanywhere.XMLHandler.sendDOMDocument(XMLHandler.java:
123)
at org.ajaxanywhere.XMLHandler.sendZones(XMLHandler.java:
93)
at org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:
76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)

等等,在下面还能看到这样的提示:
Caused by: java.net.SocketException: Connection reset by peer: socket write error

查了下TOMCAT的文档,解释如下:

引用
Wrap an IOException identifying it as being caused by an abort of a request by a remote client.

在BAIDU和GOOGLE上找了下原因,大概归结为:

ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error的原因是由于处理http连接时,正在输出内容时,用户关闭了IE,会出现一个
"ClientAbortException",属于I/O处理中出现的一个异常,应用服务器应该会捕捉。
Connection reset by peer的原因:
经常出现的Connection reset by peer: 原因可能是多方面的,不过更常见的原因是:
①:服务器的并发连接数超过了其承载量,服务器会将其中一些连接Down掉;
②:客户关掉了浏览器,而服务器还在给客户端发送数据;
③:浏览器端按了Stop
很多人都说是客户端造成的,没有办法控制,是个比较郁闷的问题。

但是,我担心的是:虽然前台没有任何出错的迹象,但是后台会记录这个异常,日志也会疯狂爆满,时间长了,肯定会DOWN掉的,还没找到好的解决办法,若有相同经历,且优雅的解决掉的朋友,望告之,谢!

resin有一个参数ignore-client-disconnect
tomcat似乎没有


原因:
一般是有些客户端已关闭,一些线程因为延迟等原因觉察不到此连接已结束,继续等到到出错
或是
客户端那里不停刷或一个访问
/刷新没完成前再刷,要让这个无用的线程死掉

这个问题一般是客户端在连接还没有完全建立的时候就取消连接,比如用户按了浏览器上面的“停止”按钮,一般来说没有什么问题。但是如果频繁出现,就表示很多客户端连接到Apache服务器的响应时间太长了,可能是网络的问题或者服务器性能问题。

connection reset 多半是因为对方在你未读完数据之前就关闭socket.
------------------转-end-----------------

4) java.lang.IllegalStateException: getOutputStream() has already been called for this response
2008-04-03 10:56:10,452 ERROR[org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/demo].[action]]http-0.0.0.0-443-12 Servlet.service() for serv
let action threw exception
java.lang.IllegalStateException: getOutputStream() has already been called 
for this response
        at org.apache.catalina.connector.Response.getWriter(Response.java:
599)
        at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:
195)
        at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:
124)
        at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:
117)
        at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:
182)
        at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:
115)
        at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:
75)
        at org.apache.jsp.admin.admin_005fmpob_005fexport_jsp._jspService(admin_005fmpob_005fexport_jsp.java:
119)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:
97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:
334)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:
264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:
173)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:
672)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:
463)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:
398)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:
301)
        at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:
1069)
        at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:
455)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
279)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:
1482)
        at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:
507)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
697)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:
810)

5) java.lang.OutOfMemoryError: PermGen space
This error occurs when the JVM runs out of space in the permanent generation heap. Since the defaults for the JVM are quite low, the first step should be to increase the default using -XX:MaxPermSize.

<!-- verbose garbage collection -->
<jvm-arg>-XX:MaxPermSize=256m</jvm-arg> <!-- sets the maximum size of the permanent heap (recommended) -->

In Jboss
run.conf, add like the followings:
JAVA_OPTS
="$JAVA_OPTS -XX:MaxPermSize=256m"

posted on 2008-03-31 18:06 crazycy 阅读(6663) 评论(5)  编辑  收藏 所属分类: JavaEE技术

评论

# re: 苦不堪言,iReport + JasperReports项目中的历练(二)  回复  更多评论   

呵呵,用开源的东西就是这样的!
2008-04-01 12:17 | klzz

# re: 苦不堪言,iReport + JasperReports项目中的历练(二)  回复  更多评论   

@klzz
可以参考的东西太少了
网上的资料大都停留在入门的层面。
哎,呵呵。
2008-04-01 15:35 | crazycy

# re: 苦不堪言,iReport + JasperReports项目中的历练(二)  回复  更多评论   

还是有一些资料的,也有几本书
2008-04-02 07:29 | 结下梁子

# re: 苦不堪言,iReport + JasperReports项目中的历练(二)  回复  更多评论   

@结下梁子

呵呵,一般这类不复杂的工具性质的不会买书的。

另外,iReport,Jasperreport给的例子是很赞的,但是出了问题的时候,总得自己摸索,摸索的过程往往是一个痛苦的过程,大家都可能反复经历的事情,所以能心得共享出来的,可以为后来者省去不少精力的
2008-04-02 11:42 | crazycy

# re: 苦不堪言,iReport + JasperReports项目中的历练(二)  回复  更多评论   

关于 3) java.io.EOFException 这个错误,楼主太不地道了。
最后我解决了,原因是服务器操作系统原来是英文编码的,改成中文的就可以了
2012-03-15 11:21 | 不留名

只有注册用户登录后才能发表评论。


网站导航: