[nbj2ee] access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)

  • From: "maboc" < >
  • To:
  • Subject: [nbj2ee] access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
  • Date: Tue, 29 Jan 2013 15:46:08 -0500

Hi All,

I created a smalll EE program with FORM based authentication.
I deploy it on a Glassfish 3.1 server.

After deploying I go to the (web) program.
The login form shows up fine.
After succesfully login I get following java stack.


Code:

javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: 
Could not create stateless EJB
        at 
com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:454)
        at 
com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2547)
        at 
com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1899)
        at 
com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:205)
        at 
com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:79)
        ...
        ...
Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not 
create stateless EJB
        at 
com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:726)
        at 
com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:247)
        at 
com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:449)
        ... 83 more
Caused by: javax.ejb.CreateException: Could not create stateless EJB
        at 
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:534)
        at 
com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:95)
        at 
com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:724)
        ... 85 more
Caused by: java.lang.RuntimeException: java.security.AccessControlException: 
access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)
        at 
org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:65)
        at 
org.jboss.weld.util.reflection.SecureReflections.ensureAccessible(SecureReflections.java:283)
        at 
org.jboss.weld.introspector.jlr.WeldConstructorImpl.newInstance(WeldConstructorImpl.java:206)
        at 
org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:117)
        at 
org.jboss.weld.manager.SimpleInjectionTarget.produce(SimpleInjectionTarget.java:98)
        at 
org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:276)
        at 
com.sun.ejb.containers.BaseContainer.injectEjbInstance(BaseContainer.java:1687)
        at 
com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:494)
        ... 87 more
Caused by: java.security.AccessControlException: access denied 
(java.lang.reflect.ReflectPermission suppressAccessChecks)
        at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
        at 
java.security.AccessController.checkPermission(AccessController.java:546)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at 
java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:107)
        at 
org.jboss.weld.util.reflection.SecureReflections$14.work(SecureReflections.java:288)
        at 
org.jboss.weld.util.reflection.SecureReflections$14.work(SecureReflections.java:283)
        at 
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
        at 
org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:63)
        ... 94 more




The last bit of the stacktrace is (to me) the most interesting.

Code:
Caused by: java.security.AccessControlException: access denied 
(java.lang.reflect.ReflectPermission suppressAccessChecks)
   at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
   at 
java.security.AccessController.checkPermission(AccessController.java:546)
   at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
   at 
java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:107)
   at 
org.jboss.weld.util.reflection.SecureReflections$14.work(SecureReflections.java:288)
   at 
org.jboss.weld.util.reflection.SecureReflections$14.work(SecureReflections.java:283)
   at 
org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
   at 
org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:63)
   ... 94 more 


After some searching on the internet I found a solution (or more a 
workaround):
Add the following to the glassfish server.policy file

Code:

grant codeBase 
"file:${com.sun.aas.installRoot}/domains/domain1/applications/todo7/-" {
    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
};




This works fine for deploying the application from the glassfish console.

However when developing in NB (7.3 beta2) this doesn't work. 
"Compile and Build" and then running the application will give the above 
problem.
I guess it has something to do with the "in place deployment" done by 
netbeans.


So now the question: Does anyone has a clue how to solve this? Pointers to 
possible solutions are very welcome, because I don't like to deploy from the 
glassfish console after every little change I made. It slows me terribly down 
and the fun is leaking out of the development.

(Ow....by the way.... this is a "hobby" project, so not a real rush other 
then that I would very much like to know how this works and can be solved)






[nbj2ee] access denied (java.lang.reflect.ReflectPermission suppressAccessChecks)

maboc 01/29/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close