Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-1123

NPE at NormalScopeProxyFactory.createNormalScopeProxy during deserialization

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.2
    • 1.7.0
    • None
    • None
    • TomEE 7.0.0.M2

    Description

      Imagine a session scoped bean which has an application scoped bean injected as property and it's being referenced in readObject().

      @SessionScoped
      public class SessionScopedBean {
      
          @Inject
          private ApplicationScopedBean appBean;
      
          private void readObject(ObjectInputStream input) throws IOException, ClassNotFoundException {
              appBean.doSomething();
          }
      }
      

      OWB 1.6.2 as used in TomEE 7.0.0.M2 throws below exception when TomEE is restarted with session persistence (and above bean is created during that session):

      java.lang.NullPointerException
          at org.apache.webbeans.proxy.NormalScopeProxyFactory.createNormalScopeProxy(NormalScopeProxyFactory.java:121)
          at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.readResolve(NormalScopedBeanInterceptorHandler.java:125)
      

      It works fine in all Weld 2.x versions I tested so far (WF8/9/10, PY4 and "plain" Tomcat8+Weld 2.3.0).

      Work around would be to use a static method on application scoped bean, but this is not nice.

      Attachments

        Activity

          People

            struberg Mark Struberg
            balusc Bauke Scholtz
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: