java.security.AccessControlException在小程序 [英] java.security.AccessControlException in Applet

查看:259
本文介绍了java.security.AccessControlException在小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的小程序,它需要下载其他网站上的CSV文件来运行。

当我运行小程序的appletviewer,它给了我这个异常:

  java.security.AccessControlException:访问被拒绝(java.net.SocketPermision www.xxxsitexxx.com:80~~MD~~aux连接,解决
   ....

我的applet的签署:

 的jarsigner -verify myfile.jar>>结果:罐子验证。

我想补充:

  {补助
      权限java.security.AllPermission;
    };

到Tomcat的文件夹:

  ..的conf / catalina.policy里

但它没有工作。

谷歌提出我的安全在未经许可添加到:

  ...的jre / lib / security中/ java.policy文件

但我无法改变它:

 来...访问的jre / lib / security中/ java.policy中被拒绝。

我的问题是:


  1. 是否添加到java.policy文件来解决问题的权限?

  2. 如果是这样,我怎么可以改变的java.policy的内容?

PS:我看了很多问题,这里涉及到我的#1的问题,但我找不到解决的正确方法

 编辑:我签署了需要使用Applet运行所有jar文件得到了Applet的工作。


解决方案

您需要给你的小应用程序的权限的不可以 Tomcat的

请参阅如何授予小程序所需的权限

Inside my Applet, it needs to download the csv file from other site to run.

When i run applet with appletviewer, it gave me this exception :

java.security.AccessControlException: access denied (java.net.SocketPermision www.xxxsitexxx.com:80 connect, resolve
   ....

My applet's signed :

 jarsigner -verify myfile.jar >> the result :  jar verified.

I tried to add :

grant {
      permission java.security.AllPermission;
    };

into Tomcat's folder :

..conf/catalina.policy

But it didn't work.

Google suggests me to add security permisson to :

... jre/lib/security/java.policy

But I couldn't change it :

Access to ... jre/lib/security/java.policy was denied.

My question is :

  1. Does add permission to java.policy solve to problem?
  2. If so, how could I change java.policy's content?

PS : I read many questions here relate to my problem in Stackoverflow, but I couldn't find the right way to solve it.

EDIT : i got the Applet work by signing all jar files that needed to run with the Applet.

解决方案

You need to give your applet the permissions not your Tomcat

See how to Grant the Required Permission for Applets

这篇关于java.security.AccessControlException在小程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆