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

Injection of session scoped bean in an EAR fails with NPE

XMLWordPrintable

    • Hide

      To reproduce the issue, deploy the attached EAR to glassfish b30(that integrates Weld 1.1.0.BETA2). Please let me know should you need the full sources of the ear.
      public class NormalLookupInEARServlet extends HttpServlet {
      ..
      @Inject
      TestBean tw;
      }

      public interface TestBean

      { public void m1(); }

      @SessionScoped
      public class TestBeanWARImpl implements TestBean {
      @Override
      public void m1()

      { System.out.println("TestBean::m1"); }

      }

      Show
      To reproduce the issue, deploy the attached EAR to glassfish b30(that integrates Weld 1.1.0.BETA2). Please let me know should you need the full sources of the ear. public class NormalLookupInEARServlet extends HttpServlet { .. @Inject TestBean tw; } public interface TestBean { public void m1(); } @SessionScoped public class TestBeanWARImpl implements TestBean { @Override public void m1() { System.out.println("TestBean::m1"); } }

      Injection of a session scoped Bean into a Servlet in an EAR fails with 1.1.0.BETA2. This used to pass earlier.

      Related GlassFish issue: https://glassfish.dev.java.net/issues/show_bug.cgi?id=14832

      It appears that resolvedBean is null at https://github.com/weld/core/blob/1.1.0.Beta2/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java#L729

      Caused by: java.lang.NullPointerException
      at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:729)
      at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:137)
      at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:869)
      at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:881)
      at org.jboss.weld.manager.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:122)
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:134)
      at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:50)
      at org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:116)

              pmuiratbleepbleep Pete Muir (Inactive)
              sivakumart_jira Sivakumar Thyagarajan (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: