我在此代码中遇到以下异常, 请帮帮我,
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(">");
}
答案 0 :(得分:2)
这很可能是用户访问权限问题。用户(服务器?)需要对输出文件具有修改权限。某些图表渲染器会在/ temp文件夹中创建文件,因此用户/服务器也需要在此文件夹上创建和修改文件的权限。
我认为,完整堆栈跟踪包括一个基础IOException,其中包含原因的详细描述(如“拒绝访问”等)。
修改强>
要解决此问题,请在调试器中运行该应用程序,并在javax.imageio.IIOException
上设置断点。然后,当应用程序在该断点上停止时,查看变量(您可能必须向下移动堆栈跟踪)以查找无法用于写入的文件的名称。然后查看文件系统并检查文件或封闭的foder是否被写保护。
答案 1 :(得分:2)
我是cewolf项目的维护者,我刚刚上传了一个可以解决这个问题的新版本(1.1.1)。给它一个旋转,让我们知道它是如何工作的。如果问题仍然存在,请访问JavaRanch上的“其他开源项目”论坛;这就是我支持cewolf的地方。
答案 2 :(得分:1)
如果您在Apache home目录中找不到临时目录时使用Apache此错误。
javax.imageio.IIOException : Can't create output stream!
示例:C:\ Apache \ temp