You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@batchee.apache.org by "Alexander Falb (JIRA)" <ji...@apache.org> on 2017/11/20 15:14:00 UTC
[jira] [Created] (BATCHEE-124) RequestScoped
ContextNotActiveException in CLI
Alexander Falb created BATCHEE-124:
--------------------------------------
Summary: RequestScoped ContextNotActiveException in CLI
Key: BATCHEE-124
URL: https://issues.apache.org/jira/browse/BATCHEE-124
Project: BatchEE
Issue Type: Bug
Components: batchee-cli
Reporter: Alexander Falb
When starting a batch via the batchee-cli runner (with batchee-cdi.jar in lib/ and {{openejb.scan.webapp.container=true}}) I get a ContextNotActiveException for RequestScoped beans.
{code}
public class EntityManagerProducer {
@PersistenceUnit(unitName = "unitname") private EntityManagerFactory emf;
@Produces @Request public EntityManager createEntityManager() {
return emf.createEntityManager();
}
}
public class MyReader implements ItemReader {
@Inject EntityManager em;
}
{code}
results in:
{code}
Caused by: 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.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:71)
at org.apache.webbeans.custom.persistence.EntityManager$$OwbNormalScopeProxy0.createNativeQuery(javax/persistence/EntityManager.java)
at at.sozvers.pva.testbatch.KontoerstgutschriftStatistikReader.doRead(KontoerstgutschriftStatistikReader.java:56)
at at.sozvers.pva.testbatch.KontoerstgutschriftStatistikReader.doRead(KontoerstgutschriftStatistikReader.java:20)
at org.apache.batchee.extras.typed.TypedItemReader.readItem(TypedItemReader.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.batchee.container.proxy.BatchProxyInvocationHandler.invoke(BatchProxyInvocationHandler.java:55)
at com.sun.proxy.$Proxy86.readItem(Unknown Source)
at org.apache.batchee.container.impl.controller.chunk.ChunkStepController.readItem(ChunkStepController.java:284)
... 16 more
{code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)