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

Resource injection now generates NPE in SE mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 3.0.0.Alpha14, 2.3.2.Final
    • 2.3.1.Final
    • None
    • None

      This seems to be a regression/behavioural change from 2.2.6 (the last time I was trying this).

      Scenario: I have an Arquillian test that is leveraging somewhere in its hierarchy an EntityManager. That entity manager is injected using @PersistenceContext. In Weld 2.2.6 that field would end up being null. In 2.3.1, that field is now throwing a Null Pointer Exception

      java.lang.NullPointerException
      at org.jboss.weld.util.Preconditions.checkNotNull(Preconditions.java:51)
      at org.jboss.weld.injection.AbstractResourceInjection.<init>(AbstractResourceInjection.java:39)
      at org.jboss.weld.injection.FieldResourceInjection.<init>(FieldResourceInjection.java:48)
      at org.jboss.weld.injection.ResourceInjectionFactory$ResourceInjectionProcessor.createFieldResourceInjection(ResourceInjectionFactory.java:217)
      at org.jboss.weld.injection.ResourceInjectionFactory$ResourceInjectionProcessor.createResourceInjections(ResourceInjectionFactory.java:189)
      at org.jboss.weld.injection.ResourceInjectionFactory.discoverType(ResourceInjectionFactory.java:449)
      at org.jboss.weld.injection.ResourceInjectionFactory.getResourceInjections(ResourceInjectionFactory.java:97)
      at org.jboss.weld.injection.producer.ResourceInjector.<init>(ResourceInjector.java:59)
      at org.jboss.weld.injection.producer.ResourceInjector.of(ResourceInjector.java:49)
      at org.jboss.weld.injection.producer.BeanInjectionTarget.<init>(BeanInjectionTarget.java:63)
      at org.jboss.weld.injection.producer.BeanInjectionTarget.createDefault(BeanInjectionTarget.java:47)
      at org.jboss.weld.manager.InjectionTargetFactoryImpl.chooseInjectionTarget(InjectionTargetFactoryImpl.java:128)
      at org.jboss.weld.manager.InjectionTargetFactoryImpl.createInjectionTarget(InjectionTargetFactoryImpl.java:87)
      at org.jboss.weld.bean.ManagedBean.<init>(ManagedBean.java:100)
      at org.jboss.weld.bean.ManagedBean.of(ManagedBean.java:80)
      at org.jboss.weld.bootstrap.AbstractBeanDeployer.createManagedBean(AbstractBeanDeployer.java:261)
      at org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:228)
      at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:78)
      at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:75)
      at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
      at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
      

              mkouba@redhat.com Martin Kouba
              meetoblivion_jira John Ament (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: