The JVM throws a java.security.AccessControlException: access denied (java.lang.reflect.ReflectPermission suppressAccessChecks) when generated meta classes try to use reflection and Java 2 security is enabled.

This occurs even after adding the following line to the policy file for the application:

        permission java.lang.reflect.ReflectPermission "suppressAccessChecks";

But this only applies to classes that are loaded from the file system. It does not affect meta classes generated by hibernate. To fix the problem, we had to add the following to the $JAVA_HOME/jre/lib/security/java.policy file:

        permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
        permission java.lang.RuntimePermission "defineCGLIBClassInJavaPackage";

But now these permissions are applied to every class that is loaded by the JVM, which is something we would like to avoid.

Is there a way to get hibernate to load the generated meta classes from the file system so we could apply a policy to that location on the file system? Or is there a better way to set the policy for the meta classes?

Thanks,

Travis Rein

Reply via email to