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

NPE when deserializing noncontextual objects in a new container instance

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.2.0.Beta1
    • 2.1.2.Final
    • None
    • None

    Description

      When a noncontextual object with injected values is serialized and later deserialized in a new container (ie. after restarting the container), the following NPE occurs:

      java.lang.NullPointerException
        at org.jboss.weld.annotated.slim.backed.BackedAnnotatedField$SerializationProxy.getCandidates(BackedAnnotatedField.java:114)
        at org.jboss.weld.annotated.slim.backed.BackedAnnotatedMember$BackedAnnotatedMemberSerializationProxy.resolve(BackedAnnotatedMember.java:57)
        at org.jboss.weld.annotated.slim.backed.BackedAnnotatedField$SerializationProxy.readResolve(BackedAnnotatedField.java:109)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1104)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1807)
      ....
      

      The reason is that BackedAnnotatedMemberSerializationProxy.type is null, because the type is not yet known to the container. Serializing the object and then deserializing works as expected.

      Attachments

        Activity

          People

            rhn-engineering-jharting Jozef Hartinger
            papegaaij Emond Papegaaij
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: