Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsAccessControlException using LTW in a custom classloader with a security manager
https://www.eclipse.org/forums/index.php/mv/msg/189110/599798/#msg_599798
under a security manager which gives AllPermissions to aspectj but
restricted permissions to the classes defined by the custom classloader
i.e. the classes loaded by the custom classloader are in a sandbox.
When instantiating a sandboxed class, I receive an AccessControlException
because aspectj is performing an operation for which the sandboxed class
(which is also on the stack) does not have permission.
I don't want to hack the aspectj code to wrap calls to Class/ClassLoader
in doPrivileged. Is there another way to make this work?
I am using aspectj 1.5.4
Stack trace:
Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission getClassLoader)
at
java.security.AccessControlContext.checkPermission(AccessCon trolContext.java:264)
at
java.security.AccessController.checkPermission(AccessControl ler.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.ja va:532)
at java.lang.Class.getClassLoader(Class.java:588)
at org.aspectj.runtime.reflect.Factory.<init>(Factory.java:71)
at MySandboxedClass.<clinit>(MySandboxedClass.java:1)