writeImageAs... fails on etomcat, exception WinNTFileSystem

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Jim McGlaughlin
Posts: 26
Joined: Tue Jul 25, 2006 9:16 pm
Location: Newburyport, MA USA
Contact:

writeImageAs... fails on etomcat, exception WinNTFileSystem

Post by Jim McGlaughlin » Mon Dec 13, 2010 8:45 am

I need to run my applets on Apache Tomcat eTomcat. I did most of my development using Apache Tomcat.

ChartUtilities.writeImageAsPNG/JPEG works ok under Apache Tomcat.

With Apache Tomcat eTomcat (a pure Java implementation) I have tried using both OutputStream and ServletOutputStream as returned from HttpServletRequest.getOutputStream().

writeImageAsJPEG fails with the exception > FAILED with IOException: Can't create cache file!

writeImageAsJPEG fails with the exception > FAILED with IOException: Can't create output stream!

Below is the stacktrace, same for both. Any help would be appreciated.

Code: Select all

javax.imageio.IIOException: Can't create output stream!
	at javax.imageio.ImageIO.write(Unknown Source)
	at org.jfree.chart.encoders.SunPNGEncoderAdapter.encode(SunPNGEncoderAdapter.java:127)
	at org.jfree.chart.encoders.EncoderUtil.writeBufferedImage(EncoderUtil.java:134)
	at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:185)
	at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:136)
	at svr.HandleThresholds.processRequest(HandleThresholds.java:198)
	at svr.HandleThresholds.doGet(HandleThresholds.java:326)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	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.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	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:286)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Unknown Source)
Caused by: javax.imageio.IIOException: Can't create cache file!
	at javax.imageio.ImageIO.createImageOutputStream(Unknown Source)
	... 21 more
Caused by: java.io.IOException: The system cannot find the path specified
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.checkAndCreate(Unknown Source)
	at java.io.File.createTempFile(Unknown Source)
	at javax.imageio.stream.FileCacheImageOutputStream.<init>(Unknown Source)
	at com.sun.imageio.spi.OutputStreamImageOutputStreamSpi.createOutputStreamInstance(Unknown Source)
	... 22 more
Thanks
Jim

Locked