If a bean is annotated with @Singleton and @Startup and CDI is used this NPE is thrown:
Caused by: java.lang.NullPointerException
at org.jboss.weld.integration.instantiator.Jsr299BeanInstantiator.create(Jsr299BeanInstantiator.java:74) [:6.1.0.Final]
at org.jboss.ejb3.EJBContainer.construct(EJBContainer.java:1048) [:1.7.21]
at org.jboss.ejb3.stateless.StatelessContainer.createBeanContext(StatelessContainer.java:123) [:1.7.21]
at org.jboss.ejb3.pool.AbstractPool.createBeanContext(AbstractPool.java:94) [:1.7.21]
at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:81) [:1.7.21]
at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:62) [:1.7.21]
at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:57) [:1.7.21]
at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:54) [:1.7.21]
at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:86) [:1.7.21]
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58) [:1.7.21]
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.2.GA]
at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:95) [:1.7.21]
at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:223) [:0.0.2]
... 99 more
This happens in this cases:
- CDI activated (e.g. beans.xml present in the bean's jar. Removing the beans.xml it deploys).
- If the singleton refers to other beans in other jars (injected with @EJB) which in turn use CDI.
Removing @Startup, the deploy works.
This is probably related with WELD-982
- relates to
-
WELD-982 NPE on deploy ear with @Startup @Singleton ejb
- Resolved