"java.security.AccessControlException: access denied" executing a signet Java Applet

Posted by logoff on Stack Overflow See other posts from Stack Overflow or by logoff
Published on 2012-07-03T08:31:59Z Indexed on 2012/07/03 9:15 UTC
Read the original article Hit count: 451

I have a little Java Applet and I have an annoying issue. I have signed my JAR with my own keystore using jarsigner tool (following these instructions).

The Java Applet downloads a signed JAR and tries to launch it with an extended class of URLClassLoader. This JAR tries to execute this line of code:

ClassLoader.getSystemClassLoader().getResource("aResource");

It fails with a large stack trace finished by:

Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
    at java.security.AccessController.checkPermission(AccessController.java:555)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
    at java.lang.Thread.getContextClassLoader(Thread.java:1451)
    ... 21 more

When the Java Applet is launched, the user is prompted to accept the certificate if he/she trusts the publisher:

Message to the user

Even if I accept it, the exception occurred. Even if I install the certificate, and the prompt message is automatically accepted, the exception occurred.

Any help would be appreciated!

© Stack Overflow or respective owner

Related posts about java

Related posts about security