sensorweb-server-helgoland
sensorweb-server-helgoland copied to clipboard
Binary file output (pdf|png) could not be created because temp folder is not writable
I use the TS-API in combination with an SOS (see EHJ-52n/sos-uol), When requesting binary output with
.../sos/api/v1/timeseries/2/getData.png?timespan=2014-02-17T09:56:56/2014-02-17T10:12:15
I get a black screen with an error message telling me that my browser can not display the image because it contains errors.
The server log from this request:
2014-04-07 09:20:43,872 ERROR [http-bio-8080-exec-1] [BaseController.java:111] An exception occured.
org.n52.web.InternalServerException: Could not write binary to stream.
at org.n52.web.v1.ctrl.TimeseriesDataController.handleBinaryResponse(TimeseriesDataController.java:284) ~[timeseries-web-1.1.0.jar:na]
at org.n52.web.v1.ctrl.TimeseriesDataController.getTimeseriesChart(TimeseriesDataController.java:224) ~[timeseries-web-1.1.0.jar:na]
[...]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_21]
Caused by: org.n52.io.IoParseException: Could not write image to output stream.
at org.n52.io.img.ChartRenderer.encodeAndWriteTo(ChartRenderer.java:115) ~[timeseries-io-1.1.0.jar:na]
at org.n52.web.v1.ctrl.TimeseriesDataController.handleBinaryResponse(TimeseriesDataController.java:277) ~[timeseries-web-1.1.0.jar:na]
... 72 common frames omitted
Caused by: javax.imageio.IIOException: Can't create output stream!
at javax.imageio.ImageIO.write(ImageIO.java:1574) ~[na:1.7.0_21]
at org.n52.io.img.ChartRenderer.encodeAndWriteTo(ChartRenderer.java:112) ~[timeseries-io-1.1.0.jar:na]
... 73 common frames omitted
Caused by: javax.imageio.IIOException: Can't create cache file!
at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:423) ~[na:1.7.0_21]
at javax.imageio.ImageIO.write(ImageIO.java:1572) ~[na:1.7.0_21]
... 74 common frames omitted
Caused by: java.nio.file.AccessDeniedException: /opt/tomcat/temp/imageio8595928830467849206.tmp
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[na:1.7.0_21]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[na:1.7.0_21]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[na:1.7.0_21]
[...]
at javax.imageio.ImageIO.createImageOutputStream(ImageIO.java:419) ~[na:1.7.0_21]
... 75 common frames omitted
In my case, the real problem was that the tomcat7 user has no permissions to write to the tomcat default temp folder located in TOMCAT_HOME/temp.
- consider this issue in documentation
- render a default error image?
rendering default error image may lead clients to expect that everything worked ok since an image is returned from the server.
However, a technical documentation could mention this.
Could you not return an image and HTTP error code with the response?
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.