Jonathan S Fisher created TOMEE-2238:
----------------------------------------

             Summary: JMSContext Injected by TomEE [may] incorrectly assumes an 
active RequestScope or TXScope exists
                 Key: TOMEE-2238
                 URL: https://issues.apache.org/jira/browse/TOMEE-2238
             Project: TomEE
          Issue Type: Bug
            Reporter: Jonathan S Fisher


I'll try to post some code later, but we ran into this bug today.
We have an Instance<MyTask>, which is submitting MyTask to a 
ManagedExecutorService. The MyTask gets a JMXContext injected into it. So 
basically neither a RequestScope or TXScope exist.

I'm not sure what the correct behavior should be according to the JMS2 spec, 
but if there's a problem, it's probably because we're limited to thse two 
choices:
{code}
        private synchronized JMSContext context() {
            if (inTx()) {
                return findOrCreateContext(transactionStorage);
            }
            return findOrCreateContext(requestStorage);
        }
{code}

{code}
javax.enterprise.context.ContextNotActiveException: WebBeans context with scope 
type annotation @RequestScoped does not exist within current thread
        at 
org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:335)
        at 
org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:89)
        at 
org.apache.webbeans.intercept.RequestScopedBeanInterceptorHandler.getContextualInstance(RequestScopedBeanInterceptorHandler.java:76)
        at 
org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:71)
        at 
org.apache.openejb.resource.activemq.jms2.cdi.JMS2CDIExtension$RequestAutoContextDestruction$$OwbNormalScopeProxy0.find(org/apache/openejb/resource/activemq/jms2/cdi/JMS2CDIExtensio
n$RequestAutoContextDestruction.java)
        at 
org.apache.openejb.resource.activemq.jms2.cdi.JMS2CDIExtension$InternalJMSContext.findOrCreateContext(JMS2CDIExtension.java:270)
        at 
org.apache.openejb.resource.activemq.jms2.cdi.JMS2CDIExtension$InternalJMSContext.context(JMS2CDIExtension.java:266)
        at 
org.apache.openejb.resource.activemq.jms2.cdi.JMS2CDIExtension$InternalJMSContext.createTopic(JMS2CDIExtension.java:425)
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to