Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-9517

@Singleton with @Startup do not deploy (NPE) if CDI is used

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 6.1.0
    • None

      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

              Unassigned Unassigned
              mpiraccini_jira Marco Piraccini (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: