小Y

学习,分享,探讨

java.security.AccessControlException: access denied (java.util.PropertyPermi
重新把项目导入到新电脑的环境中!启动TOMCAT时报出:
java.security.AccessControlException: access denied (java.util.PropertyPermission LOG_INI write)
 at java.security.AccessControlContext.checkPermission(Unknown Source)
 at java.security.AccessController.checkPermission(Unknown Source)
 at java.lang.SecurityManager.checkPermission(Unknown Source)
 at java.lang.System.setProperty(Unknown Source)
 at com.ebs.manage.front.mainGateServlet.init(mainGateServlet.java:50)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
 at java.security.AccessController.doPrivileged(Native Method)
 at javax.security.auth.Subject.doAsPrivileged(Unknown Source)
 at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
 at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
 at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115)
 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1133)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:448)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

解决办法:在D:\Program Files\jdk6\jre\lib\security\java.policy中加入如下文红色标记就解决了


// Standard extensions get all permissions by default



grant codeBase "file:${{java.ext.dirs}}/*" {
permission java.security.AllPermission;
};


// default permissions granted to all domains


grant { 
// Allows any thread to stop itself using the java.lang.Thread.stop()
// method that takes no argument.
// Note that this permission is granted by default only to remain
// backwards compatible.
// It is strongly recommended that you either remove this permission
// from this policy file or further restrict it to code sources
// that you specify, because Thread.stop() is potentially unsafe.
// See the API specification of java.lang.Thread.stop() for more
        // information.
permission java.lang.RuntimePermission "stopThread";


// allows anyone to listen on un-privileged ports
permission java.net.SocketPermission "localhost:1024-", "listen";


// "standard" properies that can be read by anyone


permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";


permission java.util.PropertyPermission "java.specification.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";


permission java.util.PropertyPermission "java.vm.specification.version", "read";
permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
permission java.util.PropertyPermission "java.vm.specification.name", "read";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
permission java.security.AllPermission;
};

阅读更多
个人分类: java基础
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

java.security.AccessControlException: access denied (java.util.PropertyPermi

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭