java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)

QOS.ch JIRA | Andrew Bourgeois | 5 years ago
  1. 0

    Hello Simply replacing the log4j libraries with the logback ones breaks my RMI server at runtime. Please take the following code: public static void main(String[] args) throws Exception { System.setProperty("java.security.policy", "./src/main/config/java.policy"); logger.debug("Policy location: {}", System.getProperty("java.security.policy")); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } System.setProperty("java.security.policy", "./src/main/config/java.policy"); } And the following stacktrace: 01:05:37.702 [main] DEBUG be.removed.fun.removed.TestMain - Policy location: ./src/main/config/java.policy Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at java.security.AccessController.checkPermission(AccessController.java:546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.System.setProperty(System.java:725) at be.removed.fun.removed.TestMain.main(TestMain.java:18) Somehow logback broke it, I can't even set a property anymore while I was able to read it before (I tested it, reading properties give the same results). FYI: If I put the "java.policy" file into my $JAVA_HOME/jre/lib/security, the file IS taken into account. POM.xml before operation: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.0</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.0</version> </dependency> POM.xml after operation: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.0</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.0</version> </dependency> Andrew

    QOS.ch JIRA | 5 years ago | Andrew Bourgeois
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
  2. 0

    Hello Simply replacing the log4j libraries with the logback ones breaks my RMI server at runtime. Please take the following code: public static void main(String[] args) throws Exception { System.setProperty("java.security.policy", "./src/main/config/java.policy"); logger.debug("Policy location: {}", System.getProperty("java.security.policy")); if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } System.setProperty("java.security.policy", "./src/main/config/java.policy"); } And the following stacktrace: 01:05:37.702 [main] DEBUG be.removed.fun.removed.TestMain - Policy location: ./src/main/config/java.policy Exception in thread "main" java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323) at java.security.AccessController.checkPermission(AccessController.java:546) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.System.setProperty(System.java:725) at be.removed.fun.removed.TestMain.main(TestMain.java:18) Somehow logback broke it, I can't even set a property anymore while I was able to read it before (I tested it, reading properties give the same results). FYI: If I put the "java.policy" file into my $JAVA_HOME/jre/lib/security, the file IS taken into account. POM.xml before operation: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.0</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.0</version> </dependency> POM.xml after operation: <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.6.0</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.0</version> </dependency> Andrew

    QOS.ch JIRA | 5 years ago | Andrew Bourgeois
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
  3. 0

    How do I set the security.policy file for a specific application from within NetBeans?

    Stack Overflow | 6 years ago | Mike
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    java.security.policy issue using logback

    Stack Overflow | 5 years ago | AndrewBourgeois
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)
  6. 0

    Trouble writing file from within a java applet

    Stack Overflow | 6 years ago | Wojtek
    java.security.AccessControlException: access denied (java.util.PropertyPermission java.security.policy write)

    10 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.security.AccessControlException

      access denied (java.util.PropertyPermission java.security.policy write)

      at java.security.AccessControlContext.checkPermission()
    2. Java RT
      System.setProperty
      1. java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
      2. java.security.AccessController.checkPermission(AccessController.java:546)
      3. java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
      4. java.lang.System.setProperty(System.java:725)
      4 frames
    3. be.removed.fun
      TestMain.main
      1. be.removed.fun.removed.TestMain.main(TestMain.java:18)
      1 frame