Hi,
I have a problem when i am calling a servlet from jsp through img tag.
The code is working fine when tested in local, but getting problem when i deployed on DEV.
This is the code in servlet..
OutputStream out = response.getOutputStream();
response.setContentType("image/png");
ChartUtilities.writeChartAsPNG(out, chart, 400, 300);
out.close();
This is the error...
javax.imageio.IIOException: I/O error writing PNG file!
at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1116)
at javax.imageio.ImageWriter.write(ImageWriter.java:598)
at javax.imageio.ImageIO.write(ImageIO.java:1450)
at javax.imageio.ImageIO.write(ImageIO.java:1524)
at com.jpmorgan.mds.curvegraph.GraphAfterDF.doGet(GraphAfterDF.java:249)
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:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.jpmorgan.janus.webagent.j2ee.JanusFilterAgent.doFilter(JanusFilterAgent.java:174)
at com.jpmorgan.janus.webagent.j2ee.JanusFilter.doFilter(JanusFilter.java:84)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:201)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.cluster.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:210)
at org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
at java.lang.Thread.run(Thread.java:595)
Caused by: ClientAbortException: java.io.IOException
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:98)
at javax.imageio.stream.FileCacheImageOutputStream.flushBefore(FileCacheImageOutputStream.java:214)
at com.sun.imageio.plugins.png.IDATOutputStream.finishChunk(PNGImageWriter.java:172)
at com.sun.imageio.plugins.png.IDATOutputStream.finish(PNGImageWriter.java:229)
at com.sun.imageio.plugins.png.PNGImageWriter.write_IDAT(PNGImageWriter.java:894)
at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1106)
... 24 more
Caused by: java.io.IOException
at org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer(InternalAprOutputBuffer.java:700)
at org.apache.coyote.http11.InternalAprOutputBuffer.flush(InternalAprOutputBuffer.java:288)
at org.apache.coyote.http11.Http11AprProcessor.action(Http11AprProcessor.java:967)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
... 31 more
I guess its bug in jfreecharts.
Thanks for the help in Advance.
SNB
problem when when writing the graph as PNG
-
- Posts: 1
- Joined: Thu Jan 31, 2008 10:02 am
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Sorry for the delay responding.
These sound like questions for the regular JFreeChart forum, rather than Eastwood. However, two things to check:
(1) Is your server running in "headless" mode? This is a common issue when something works on your local machine, but doesn't work on the server. The exception messages are not always that helpful. See item 10 in the JFreeChart FAQ for more info:
http://www.jfree.org/jfreechart/faq.html#FAQ10
(2) Are you using JFreeChart 1.0.9 and sending JPEG images back to the client? There is a bug in JFreeChart 1.0.9 (only) with respect to JPEG images (only). You can workaround this by downgrading to JFreeChart 1.0.8 or using PNG images rather than JPEG.
If it isn't either of those things, then I'm not sure.
These sound like questions for the regular JFreeChart forum, rather than Eastwood. However, two things to check:
(1) Is your server running in "headless" mode? This is a common issue when something works on your local machine, but doesn't work on the server. The exception messages are not always that helpful. See item 10 in the JFreeChart FAQ for more info:
http://www.jfree.org/jfreechart/faq.html#FAQ10
(2) Are you using JFreeChart 1.0.9 and sending JPEG images back to the client? There is a bug in JFreeChart 1.0.9 (only) with respect to JPEG images (only). You can workaround this by downgrading to JFreeChart 1.0.8 or using PNG images rather than JPEG.
If it isn't either of those things, then I'm not sure.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
![Idea :idea:](./images/smilies/icon_idea.gif)
![Idea :idea:](./images/smilies/icon_idea.gif)
i need clarification
i have single suggestion :
David all the time when we are asking some issues while using jfrreechart
in jsp
you are saying that it should run in headless mode
but my question is
how it works fine at one time without headless mode in a server setting .how?
I am very eager to know when we can simulate this bug .....
i have already raised in genral forum , please response me ASP
David all the time when we are asking some issues while using jfrreechart
in jsp
you are saying that it should run in headless mode
but my question is
how it works fine at one time without headless mode in a server setting .how?
I am very eager to know when we can simulate this bug .....
i have already raised in genral forum , please response me ASP
Well, the ClientAbortException sends a clear message.
Your browser did not wait for the image to be sent completely. Maybe the user moved on to a different page, maybe the connection got dropped, whatever it was: You cannot do anything about it and headless mode has nothing to do with it.
HTTP is a network protocol, so you encounter connection errors from time to time. This particular exception is nothing you should worry about, it just tells you that the client went away. Ignore it.
Your browser did not wait for the image to be sent completely. Maybe the user moved on to a different page, maybe the connection got dropped, whatever it was: You cannot do anything about it and headless mode has nothing to do with it.
HTTP is a network protocol, so you encounter connection errors from time to time. This particular exception is nothing you should worry about, it just tells you that the client went away. Ignore it.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Thanks Thomas, I should read the exceptions properly!Taqua wrote:Well, the ClientAbortException sends a clear message.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
![Idea :idea:](./images/smilies/icon_idea.gif)
![Idea :idea:](./images/smilies/icon_idea.gif)
-
- Posts: 1
- Joined: Sat Dec 19, 2009 9:55 am
- antibot: No, of course not.
Re: problem when when writing the graph as PNG
Hi Snageshbabu,
I am also getting same problem.its running perfectly in my local system and not in production servers..can you tell me the proper fix for it ... please reply ASAP ....
mail id :: ravikumar.palaparthi@gmail.com
please see the following error msg ...
02:28:02,937 ERROR [STDERR] javax.imageio.IIOException: I/O error writing PNG file!
02:28:02,937 ERROR [STDERR] at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1116)
02:28:02,937 ERROR [STDERR] at javax.imageio.ImageWriter.write(ImageWriter.java:598)
02:28:02,937 ERROR [STDERR] at javax.imageio.ImageIO.write(ImageIO.java:1450)
02:28:02,937 ERROR [STDERR] at javax.imageio.ImageIO.write(ImageIO.java:1524)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.encoders.SunPNGEncoderAdapter.encode(SunPNGEncoderAdapter.java:128)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.encoders.EncoderUtil.writeBufferedImage(EncoderUtil.java:191)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.ChartUtilities.writeBufferedImageAsPNG(ChartUtilities.java:654)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:212)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:144)
02:28:02,938 ERROR [STDERR] at com.vpo.dashboard.actions.Stats.makePieChart(Stats.java:243)
02:28:02,938 ERROR [STDERR] at com.vpo.dashboard.actions.ReportStats.service(ReportStats.java:55)
02:28:02,970 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
02:28:02,970 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.ja
va:290)
------------------------------------------------------
I am also getting same problem.its running perfectly in my local system and not in production servers..can you tell me the proper fix for it ... please reply ASAP ....
mail id :: ravikumar.palaparthi@gmail.com
please see the following error msg ...
02:28:02,937 ERROR [STDERR] javax.imageio.IIOException: I/O error writing PNG file!
02:28:02,937 ERROR [STDERR] at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1116)
02:28:02,937 ERROR [STDERR] at javax.imageio.ImageWriter.write(ImageWriter.java:598)
02:28:02,937 ERROR [STDERR] at javax.imageio.ImageIO.write(ImageIO.java:1450)
02:28:02,937 ERROR [STDERR] at javax.imageio.ImageIO.write(ImageIO.java:1524)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.encoders.SunPNGEncoderAdapter.encode(SunPNGEncoderAdapter.java:128)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.encoders.EncoderUtil.writeBufferedImage(EncoderUtil.java:191)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.ChartUtilities.writeBufferedImageAsPNG(ChartUtilities.java:654)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:212)
02:28:02,937 ERROR [STDERR] at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:144)
02:28:02,938 ERROR [STDERR] at com.vpo.dashboard.actions.Stats.makePieChart(Stats.java:243)
02:28:02,938 ERROR [STDERR] at com.vpo.dashboard.actions.ReportStats.service(ReportStats.java:55)
02:28:02,970 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
02:28:02,970 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.ja
va:290)
------------------------------------------------------
snageshbabu wrote:Hi,
I have a problem when i am calling a servlet from jsp through img tag.
The code is working fine when tested in local, but getting problem when i deployed on DEV.
This is the code in servlet..
OutputStream out = response.getOutputStream();
response.setContentType("image/png");
ChartUtilities.writeChartAsPNG(out, chart, 400, 300);
out.close();
This is the error...
javax.imageio.IIOException: I/O error writing PNG file!
at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1116)
at javax.imageio.ImageWriter.write(ImageWriter.java:598)
at javax.imageio.ImageIO.write(ImageIO.java:1450)
at javax.imageio.ImageIO.write(ImageIO.java:1524)
at com.jpmorgan.mds.curvegraph.GraphAfterDF.doGet(GraphAfterDF.java:249)
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:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at com.jpmorgan.janus.webagent.j2ee.JanusFilterAgent.doFilter(JanusFilterAgent.java:174)
at com.jpmorgan.janus.webagent.j2ee.JanusFilter.doFilter(JanusFilter.java:84)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:201)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.cluster.session.JvmRouteBinderValve.invoke(JvmRouteBinderValve.java:210)
at org.apache.catalina.cluster.tcp.ReplicationValve.invoke(ReplicationValve.java:347)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:834)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:640)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286)
at java.lang.Thread.run(Thread.java:595)
Caused by: ClientAbortException: java.io.IOException
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:98)
at javax.imageio.stream.FileCacheImageOutputStream.flushBefore(FileCacheImageOutputStream.java:214)
at com.sun.imageio.plugins.png.IDATOutputStream.finishChunk(PNGImageWriter.java:172)
at com.sun.imageio.plugins.png.IDATOutputStream.finish(PNGImageWriter.java:229)
at com.sun.imageio.plugins.png.PNGImageWriter.write_IDAT(PNGImageWriter.java:894)
at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1106)
... 24 more
Caused by: java.io.IOException
at org.apache.coyote.http11.InternalAprOutputBuffer.flushBuffer(InternalAprOutputBuffer.java:700)
at org.apache.coyote.http11.InternalAprOutputBuffer.flush(InternalAprOutputBuffer.java:288)
at org.apache.coyote.http11.Http11AprProcessor.action(Http11AprProcessor.java:967)
at org.apache.coyote.Response.action(Response.java:183)
at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
... 31 more
I guess its bug in jfreecharts.
Thanks for the help in Advance.
SNB