我有一个签名的Applet加载图片。 Applet有后台线程从服务器检索图像。 最初Applet加载图像没有问题,但在加载大约7个图像后,我得到以下错误:
Routee democratRoutee = new ActorRefRoutee(democratActorRef);
Routee republicanRoutee = new ActorRefRoutee(republicanActorRef);
@Override
public Routee select(Object message, IndexedSeq<Routee> routees) {
switch ((Message) msg) {
case DemocratVote: return new NoRoutee();
case DemocratCountResult:
democratRoutee;
case RepublicanVote: return new NoRoutee();
case RepublicanCountResult:
return republicanRoutee;
default:
throw new IllegalArgumentException("Unknown message: " + msg);
}
}
执行此操作时抛出错误
java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.io.tmpdir" "read")
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
但就像我最初所说的那样,我能够读取该系统属性,但随后突然停止工作。
任何人都知道为什么会发生这种情况?其他Applet后台线程是否可以锁定读取该系统属性?因此,System.getProperty("java.io.tmpdir")
最终会抛出错误,因为它无法访问系统属性。
提前致谢!