java.security.AccessControlException:访问被拒绝(java.io.FilePermission /usr/share/java/jsp-api-2.0.jar 读取)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4689123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.security.AccessControlException: access denied (java.io.FilePermission /usr/share/java/jsp-api-2.0.jar read)
提问by Panayiotis Karabassis
I am trying to deploy me application to Tomcat 5.5 on Debian Lenny. I am getting the following exception:
我正在尝试将我的应用程序部署到 Debian Lenny 上的 Tomcat 5.5。我收到以下异常:
java.security.AccessControlException: access denied (java.io.FilePermission /usr/share/java/jsp-api-2.0.jar read)
I'm not sure what to do.
我不知道该怎么做。
Solution
解决方案
Add the following line to /etc/tomcat5.5/policy.d/04webapps.policy:
将以下行添加到 /etc/tomcat5.5/policy.d/04webapps.policy:
grant codeBase "file:/var/lib/tomcat5.5/webapps/mywebapp/-" { permission java.security.AllPermission; };
回答by Christian Kuetbach
I smells like an SecurityManager.
我闻起来像一个安全经理。
It is a message from the Java Security-Manager not from the filesystem. A class within this jar-archive tries to access a file, which is not allowed by the policy.
这是来自 Java 安全管理器的消息,而不是来自文件系统的消息。此 jar-archive 中的类尝试访问策略不允许的文件。
Take a look at this really similar problem: http://www.mkyong.com/tomcat/tomcat-javasecurityaccesscontrolexception-access-denied-loggingproperties-read/
看看这个非常相似的问题:http: //www.mkyong.com/tomcat/tomcat-javasecurityaccesscontrolexception-access-denied-loggingproperties-read/
The Solution ist to allow reading of files in the catalina.policy
解决方案是允许读取 catalina.policy
回答by Yuval Rimar
try executing as root chmod +r /usr/share/java/jsp-api-2.0.jar
尝试以 root 身份执行 chmod +r /usr/share/java/jsp-api-2.0.jar