Tags

, ,


Exceptions such as the ones below during j2ee application deployment on Oracle Glassfish are usually observed when the security manager under Configurations> server-config> Security is enabled. This is on account of Glassfish’s restriction on the way object/resource are being accessed when the security manager is on.

1) Invocation of init method failed; nested exception is java.security.AccessControlException: access denied (javax.management.MBeanServerPermission findMBeanServer)

2) Instantiation of bean failed; nested exception is java.security.AccessControlException: access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)

 

To resolve the same, the security check can either be bypassed or permissions be explicitly set.

add the following onto the server.policy file under the server configuration (config) folder

grant codeBase “file:${com.sun.aas.instanceRoot}/applications/j2ee-apps/-” {
    permission java.lang.reflect.ReflectPermission “suppressAccessChecks”;
    permission javax.management.MBeanServerPermission “*”;
    permission javax.management.MBeanPermission “*”, “*”;
    permission java.lang.RuntimePermission “createClassLoader”;
};  

Advertisements