AccessControlException 在 JSP 内创建文件
我尝试在 JSP 中创建一个新文件并尝试保存它:
final File file1 = new File("piechart.png");
ChartUtilities.saveChartAsPNG(file1, targetChart, 600, 400, info);
我收到 AccessControlException:
java.security.AccessControlException: access denied (java.io.FilePermission piechart.png write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:122)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:328)
最终目标是在同一个 JSP 中创建并显示该文件:
<IMG SRC="piechart.png" WIDTH="600" HEIGHT="400" BORDER="0" USEMAP="#chart">
此外,这是在 google 应用引擎环境中。
I try to create a new file inside a JSP and try to save it:
final File file1 = new File("piechart.png");
ChartUtilities.saveChartAsPNG(file1, targetChart, 600, 400, info);
I get a AccessControlException:
java.security.AccessControlException: access denied (java.io.FilePermission piechart.png write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
at java.security.AccessController.checkPermission(AccessController.java:546)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at com.google.appengine.tools.development.DevAppServerFactory$CustomSecurityManager.checkPermission(DevAppServerFactory.java:122)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
at java.io.FileOutputStream.<init>(FileOutputStream.java:169)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:328)
The eventual goal is to create and display the file in the same JSP:
<IMG SRC="piechart.png" WIDTH="600" HEIGHT="400" BORDER="0" USEMAP="#chart">
Also, this is inside the google app engine environment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Google 应用引擎不支持写入磁盘。
来自常见问题解答:
Google app engine doesn't support writing to disk.
From the FAQ: