0 Replies Latest reply: May 21, 2012 2:14 AM by zeeman RSS

Seam International potential bug with Stateless Async EJB

zeeman Novice

I have a stateless EJB that injects a MessageFactory. When I try to build a message in an async method I get below exception:

 

Below code runs in a method annotated with @Asynchronous

msgFactory.info(new BundleKey(ApplicationConstants.DEFAULT_BUNDLE, "bundleKey")).build().getText());

 

How can I get a bundle's key value in an async method?

 

The error:

 

02:00:17,537 ERROR [org.jboss.ejb3.invocation] (EJB default - 1) JBAS014134: EJB Invocation failed on component MailService for method

public void com.mycompany.services.mail.MailService.sendEmailAsync(com.mycompany.enums.RequestTypeEnum,java.util.List,java.util.Map):

javax.ejb.EJBException: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterpri

se.context.SessionScoped

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0

.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Fina

l]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInter

ceptor.java:41) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1

.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.

1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Fina

l]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.

1.Final]

        at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.0.Final.jar:7.1.0.F

inal]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.AsyncVoidInterceptorFactory$Task.run(AsyncVoidInterceptorFactory.java:75) [jboss-as

-ejb3-7.1.0.Final.jar:7.1.0.Final]

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]

        at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

Caused by: org.jboss.weld.context.ContextNotActiveException: WELD-001303 No active contexts for scope type javax.enterprise.context.Ses

sionScoped

        at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:598) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31

]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:

31]

        at org.jboss.weld.bean.AbstractReceiverBean.getReceiver(AbstractReceiverBean.java:73) [weld-core-1.1.5.AS71.Final.jar:2012-02-1

0 15:31]

        at org.jboss.weld.bean.ProducerField$1.produce(ProducerField.java:119) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

        at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:299) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15

:31]

        at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61) [weld-core-1.1.5.AS71.Final.jar:2012-0

2-10 15:31]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:

31]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:

31]

        at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10

15:31]

        at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

        at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

        at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161) [weld-core-1.1.5.AS71.Final.jar

:2012-02-10 15:31]

        at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 1

5:31]

        at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157) [weld-core-1.1.5.AS71.Final.jar:2012

-02-10 15:31]

        at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31

]

        at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153) [weld-core-1.1.5.AS71.Final.jar:2012

-02-10 15:31]

        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

        at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61) [weld-core-1.1.5.AS71.Final.jar:2012-0

2-10 15:31]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:

31]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:643) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:

31]

        at org.jboss.seam.international.status.MessageFactory.getContextualInstance(MessageFactory.java:128) [seam-international-api-3.

1.0.Final.jar:3.1.0.Final]

        at org.jboss.seam.international.status.MessageFactory.info(MessageFactory.java:46) [seam-international-api-3.1.0.Final.jar:3.1.

0.Final]

        at com.mycompany.services.mail.MailService.handleEmail(MailService.java:89) [classes:]

        at com.mycompany.services.mail.MailService.sendEmailAsync(MailService.java:65) [classes:]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_31]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_31]

        at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]

        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(Manag

edReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.1.Final.jar:1.

1.1.Final]

        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:127) [jboss-as-weld-7.1.

0.Final.jar:7.1.0.Final]

        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:135) [jboss-as-weld-7.1.0.F

inal.jar:7.1.0.Final]

        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-

ee-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.

Final]

        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-

ee-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [jboss-as-jpa-7.1.0.

Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:103)

[jboss-as-weld-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.

1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.

1.Final]

        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:

53) [jboss-as-ee-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ej

b3-7.1.0.Final.jar:7.1.0.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.0.Final.jar:7.1.0.Final]

        ... 20 more