我在这段代码中遇到了以下异常,请务必帮助我,
javax.imageio.IIOException: Can't create output stream!
de.laures.cewolf.ChartRenderingException: Can't create output stream!
javax.servlet.jsp.JspException: Can't create output stream!
at de.laures.cewolf.taglib.tags.ChartMapTag.doStartTag(ChartMapTag.java:117) 代码如下所示
try {
Dataset dataset = PageUtils.getDataset(chartId, pageContext);
Writer out = pageContext.getOut();
final boolean isIE = BrowserDetection.isIE((HttpServletRequest) pageContext.getRequest());
if (hasToolTips()) {
enableToolTips(out, isIE);
}
out.write("<MAP name=\"" + chartId + "\">\n");
ChartRenderingInfo info = (ChartRenderingInfo) root.getRenderingInfo();
Iterator entities = info.getEntityCollection().iterator();
while (entities.hasNext()) {
ChartEntity ce = (ChartEntity) entities.next();
out.write("\n<AREA shape=\"" + ce.getShapeType() + "\" ");
out.write("COORDS=\"" + ce.getShapeCoords() + "\" ");
if (ce instanceof XYItemEntity)
{
dataset = ((XYItemEntity)ce).getDataset();
}
if (!(ce instanceof LegendItemEntity)) {
if (hasToolTips()) {
writeOutToolTip(dataset, out, isIE, ce);
}
if (hasLinks()) {
writeOutLink(linkGenerator, dataset, out, ce);
}
}
out.write(">");
}发布于 2010-08-12 14:21:59
这很可能是用户访问权限的问题。用户(服务器?)需要对输出文件具有修改权限。一些图表呈现器在临时文件夹的/中创建文件,因此用户/服务器也需要在此文件夹上创建和修改文件的权限。
我认为,完整的堆栈跟踪包括一个底层IOException,其中包含对原因的详细描述(如“拒绝访问”之类)。
编辑
若要解决此问题,请在调试器中运行应用程序并在javax.imageio.IIOException上设置断点。然后,当应用程序在该断点处停止时,查看不能用于写入的文件名的变量(您可能需要向下移动堆栈跟踪)。然后查看文件系统并检查文件或附件是否有写保护。
发布于 2010-08-12 19:03:43
我是cewolf项目的维护者,我刚刚上传了一个可能解决这个问题的新版本(1.1.1)。给它一个旋转,让我们知道它是如何工作的。如果问题仍然存在,请转到JavaRanch上的“其他开源项目”论坛;在那里我支持cewolf。
发布于 2012-11-01 19:52:02
如果您使用Apache,则在Apache主目录中找不到临时目录时会出现此错误。
javax.imageio.IIOException : Can't create output stream!示例: C:\Apache\temp
https://stackoverflow.com/questions/3465144
复制相似问题