Access Denial Issue on Glassfish during j2ee application deployment

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”;
};  

Advertisement

Leave a Comment

No comments yet.

Comments RSS TrackBack Identifier URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.