刚刚学习Google app engine时,想用debug模式启动但是报错。网上找不到相应的答案。
只给出以下信息。不知如何入手,程序没有问题,可以用直接run as webapplication
但是一debug就出错
java.lang.RuntimeException: Cannot generate policy file.
at com.google.apphosting.utils.security.SecurityManagerInstaller.install(SecurityManagerInstaller.java:106)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:67)
at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:40)
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:153)
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
at com.google.appengine.tools.development.DevAppServerMain.(DevAppServerMain.java:113)
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
Caused by: java.io.IOException: ????????????????
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.checkAndCreate(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at java.io.File.createTempFile(Unknown Source)
at com.google.apphosting.utils.security.SecurityManagerInstaller.generatePolicyFile(SecurityManagerInstaller.java:143)
at com.google.apphosting.utils.security.SecurityManagerInstaller.install(SecurityManagerInstaller.java:104)
... 6 more
[b]问题补充:[/b]
我的程序里确实引用了一个java.io这个包。我参考Google上的文档做的一个小例子,参考例子是一个servlet,里面就引用了一个java.io这个包。文档里面还提示说使用debug,修改代码后可以自动重新编译。我就用了,结果报错了。
如果我修改代码后,想重新部署怎么办?能否像tomcat那样,点击方便的部署?
看log,应该是你的程序或者引用的其它包邮用到了java.io这个包的东西,目前GAE for java,不支持这个包。
具体现在GAE for Java支持什么看下面的连接:
[url]http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine[/url]
看看这个限制
http://code.google.com/intl/zh-CN/appengine/docs/java/runtime.html#The_Sandbox
The Filesystem
A Java application cannot use any classes used to write to the filesystem, such as java.io.FileWriter. An application can read its own files from the filesystem using classes such as java.io.FileReader. An application can also access its own files as "resources", such as with Class.getResource() or ServletContext.getResource().
Only files that are considered "resource files" are accessible to the application via the filesystem. By default, all files in the WAR are "resource files." You can exclude files from this set using the appengine-web.xml file.
本地是自动部署的,放GAE上的话就要重新放一次了