glassfish
  1. glassfish
  2. GLASSFISH-19850

Can't inject JMSContext when security manager is enabled

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0_b80_EE7MS6
    • Fix Version/s: 4.0_b85
    • Component/s: cdi
    • Labels:
      None

      Description

      When I tried to add the JMS injection quicklook case, I found it failed in hudson jobs because security manager is enabled by default in hudson jobs.

      It is easy to be reproduced: Enable the security manager for the domain by adding an option in the JVM Settings and then restart glassfish domain/server. We can see the following exception when accessing the EJB/Web with JMSContext injection (deployment succeeds).

      [2013-03-13T14:04:01.787+0800] [glassfish 4.0] [INFO] [AS-WEB-GLUE-00172] [javax.enterprise.web] [tid: _ThreadID=40 _ThreadName=admin-listener(1)] [timeMillis: 1363154641787] [levelValue: 800] [[
      Loading application [injection] at [/injection]]]

      [2013-03-13T14:04:01.849+0800] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=40 _ThreadName=admin-listener(1)] [timeMillis: 1363154641849] [levelValue: 800] [[
      injection was successfully deployed in 3,416 milliseconds.]]

      [2013-03-13T14:04:02.910+0800] [glassfish 4.0] [INFO] [] [javax.enterprise.system.core.security] [tid: _ThreadID=26 _ThreadName=http-listener-1(1)] [timeMillis: 1363154642910] [levelValue: 800] [[
      JACC Policy Provider: Failed Permission Check, context(injection/injection)- permission(("java.lang.reflect.ReflectPermission" "suppressAccessChecks"))]]

      [2013-03-13T14:04:03.066+0800] [glassfish 4.0] [SEVERE] [ejb.stateless_ejbcreate_exception] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [tid: _ThreadID=26 _ThreadName=http-listener-1(1)] [timeMillis: 1363154643066] [levelValue: 1000] [[
      EJB5070: Exception creating stateless session bean : [SimpleEjb]]]

      [2013-03-13T14:04:03.066+0800] [glassfish 4.0] [WARNING] [ejb.system_exception] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [tid: _ThreadID=26 _ThreadName=http-listener-1(1)] [timeMillis: 1363154643066] [levelValue: 900] [[
      EJB5184:A system exception occurred during an invocation on EJB SimpleEjb, method: public boolean org.glassfish.tests.jms.injection.SimpleEjb.testRequestScope()]]

      [2013-03-13T14:04:03.066+0800] [glassfish 4.0] [WARNING] [] [javax.enterprise.system.container.ejb.com.sun.ejb.containers] [tid: _ThreadID=26 _ThreadName=http-listener-1(1)] [timeMillis: 1363154643066] [levelValue: 900] [[

      javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
      at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:435)
      at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2534)
      at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1924)
      at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:210)
      at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:88)
      at $Proxy310.testRequestScope(Unknown Source)
      at org.glassfish.tests.jms.injection._EJB31_GeneratedSimpleEjbIntf__Bean_.testRequestScope(Unknown Source)
      at org.glassfish.tests.jms.injection.TestServlet.processRequest(TestServlet.java:80)
      at org.glassfish.tests.jms.injection.TestServlet.doGet(TestServlet.java:99)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:323)
      at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:321)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAsPrivileged(Subject.java:536)
      at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:356)
      at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:214)
      at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1676)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:176)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
      at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
      at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:700)
      at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:246)
      at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:430)
      ... 46 more
      Caused by: javax.ejb.CreateException: Could not create stateless EJB
      at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:514)
      at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:97)
      at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:698)
      ... 48 more
      Caused by: com.google.common.collect.ComputationException: org.jboss.weld.exceptions.WeldException: WELD-001524 Unable to load proxy class for bean org.glassfish.jms.injection.JMSCDIExtension$LocalBean@e5472a with class class org.glassfish.jms.injection.RequestedJMSContextManager using classloader WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
      at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:400)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:181)
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:745)
      at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:76)
      at org.jboss.weld.injection.ConstructorInjectionPoint.getParameterValues(ConstructorInjectionPoint.java:108)
      at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:58)
      at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:29)
      at org.jboss.weld.injection.producer.DefaultInstantiator.newInstance(DefaultInstantiator.java:67)
      at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:84)
      at org.glassfish.jms.injection.JMSCDIExtension$LocalBean.create(JMSCDIExtension.java:208)
      at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:687)
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:745)
      at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:88)
      at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:368)
      at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:377)
      at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:72)
      at org.jboss.weld.injection.producer.StatelessSessionBeanInjector.inject(StatelessSessionBeanInjector.java:50)
      at org.jboss.weld.injection.producer.DefaultInjector$1.proceed(DefaultInjector.java:66)
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:133)
      at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46)
      at org.jboss.weld.injection.producer.DefaultInjector.inject(DefaultInjector.java:64)
      at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:96)
      at org.glassfish.weld.services.JCDIServiceImpl.injectEJBInstance(JCDIServiceImpl.java:251)
      at com.sun.ejb.containers.BaseContainer.injectEjbInstance(BaseContainer.java:1701)
      at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:475)
      ... 50 more
      Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524 Unable to load proxy class for bean org.glassfish.jms.injection.JMSCDIExtension$LocalBean@e5472a with class class org.glassfish.jms.injection.RequestedJMSContextManager using classloader WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
      at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:298)
      at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:253)
      at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:100)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:157)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:147)
      at org.jboss.weld.bean.proxy.ClientProxyProvider.access$000(ClientProxyProvider.java:49)
      at org.jboss.weld.bean.proxy.ClientProxyProvider$1.apply(ClientProxyProvider.java:57)
      at org.jboss.weld.bean.proxy.ClientProxyProvider$1.apply(ClientProxyProvider.java:53)
      at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:358)
      at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
      at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
      at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
      at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:396)
      ... 76 more
      Caused by: java.security.AccessControlException: access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")
      at java.security.AccessControlContext.checkPermission(AccessControlContext.java:366)
      at java.security.AccessController.checkPermission(AccessController.java:560)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
      at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:128)
      at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:102)
      at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:91)
      at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:408)
      at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:291)
      ... 88 more
      ]]

        Issue Links

          Activity

          Hide
          Nigel Deakin added a comment -

          Setting fix version to 4.0. This bug currently causes failure of the JMSContext injection quicklook tests

          Show
          Nigel Deakin added a comment - Setting fix version to 4.0. This bug currently causes failure of the JMSContext injection quicklook tests
          Hide
          jjsnyder83 added a comment -

          JBoss is aware of the issue. See https://issues.jboss.org/browse/WELD-1242

          Show
          jjsnyder83 added a comment - JBoss is aware of the issue. See https://issues.jboss.org/browse/WELD-1242
          Hide
          David Zhao added a comment -

          JJ,

          I tried latest build with revision 67218, and can't reproduce the problem. Could you please verify if/when the defect is available to be closed?

          -david

          Show
          David Zhao added a comment - JJ, I tried latest build with revision 67218, and can't reproduce the problem. Could you please verify if/when the defect is available to be closed? -david
          Hide
          jjsnyder83 added a comment -

          David,
          Can you try it again on the latest trunk. Before you start quicklook do the following:

          1) start GF
          2) use asadmin to do the following 2 commands

          asadmin create-module-config cdi-service
          asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=true

          3) stop GF

          4) run quicklook.

          Then do it all over again except set the enable-implicit-cdi=false.

          thanks,
          JJ

          Show
          jjsnyder83 added a comment - David, Can you try it again on the latest trunk. Before you start quicklook do the following: 1) start GF 2) use asadmin to do the following 2 commands asadmin create-module-config cdi-service asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=true 3) stop GF 4) run quicklook. Then do it all over again except set the enable-implicit-cdi=false. thanks, JJ
          Hide
          David Zhao added a comment -

          JJ,

          I tried jms injection devtests and QL with both enable-implicit-cdi=true and enable-implicit-cdi=false against revision 61359, it worked fine and all passed.

          -david

          Show
          David Zhao added a comment - JJ, I tried jms injection devtests and QL with both enable-implicit-cdi=true and enable-implicit-cdi=false against revision 61359, it worked fine and all passed. -david

            People

            • Assignee:
              jjsnyder83
              Reporter:
              David Zhao
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: