Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1660

Registering alternative during AfterTypeDiscovery event fails with NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.2.1.Final
    • None
    • None
    • None

      Following code fails with NPE, because the priority is null in org.jboss.weld.bootstrap.enablement.GlobalEnablementBuilder#getGlobalAlternativeMap

      public void afterTypeDiscovery(@Observes AfterTypeDiscovery event) {
              event.getAlternatives().add(IntegerBean.class);
      }
      

      Stacktrace:

      13:54:10,245 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."4ded9a73-c1a8-48b2-b884-ec631181e7b3.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."4ded9a73-c1a8-48b2-b884-ec631181e7b3.war".WeldStartService: Failed to start service
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]
      	at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]
      Caused by: java.lang.NullPointerException: null value in entry: class org.jboss.cdi.tck.tests.definition.bean.custom.IntegerBean=null
      	at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33)
      	at com.google.common.collect.SingletonImmutableBiMap.<init>(SingletonImmutableBiMap.java:39)
      	at com.google.common.collect.ImmutableBiMap.of(ImmutableBiMap.java:57)
      	at com.google.common.collect.ImmutableMap.of(ImmutableMap.java:80)
      	at com.google.common.collect.ImmutableMap.copyOf(ImmutableMap.java:292)
      	at org.jboss.weld.bootstrap.enablement.GlobalEnablementBuilder.getGlobalAlternativeMap(GlobalEnablementBuilder.java:193)
      	at org.jboss.weld.bootstrap.enablement.GlobalEnablementBuilder.createModuleEnablement(GlobalEnablementBuilder.java:236)
      	at org.jboss.weld.bootstrap.BeanDeployment.createEnablement(BeanDeployment.java:219)
      	at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:363)
      	at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:76)
      	at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:91)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
      	... 3 more
      
      

              mkouba@redhat.com Martin Kouba
              tremes1@redhat.com Tomas Remes
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: