Log4j 2
  1. Log4j 2
  2. LOG4J2-142

Exception while deserializing event from SocketAppender

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta3
    • Fix Version/s: 2.0-beta4
    • Component/s: None
    • Labels:
      None
    • Environment:

      Description

      I get the following error message:
      java.lang.ClassCastException: cannot assign instance of java.lang.StackTraceElement to field java.lang.Throwable.cause of type java.lang.Throwable in instance of org.apache.logging.log4j.core.impl.ThrowableProxy
      at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2063) ~[na:1.7.0_10]
      at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1241) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1970) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:498) ~[na:1.7.0_10]
      at java.lang.Throwable.readObject(Throwable.java:913) ~[na:1.7.0_10]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_10]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_10]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_10]
      at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_10]
      at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1004) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1866) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) ~[na:1.7.0_10]
      a.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1964) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1888) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) ~[na:1.7.0_10]
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) ~[na:1.7.0_10]
      at de.huxhorn.lilith.engine.impl.eventproducer.AbstractStreamEventProducer$ReceiverRunnable.run(AbstractStreamEventProducer.java:83) ~[de.huxhorn.lilith.engine-0.9.43-SNAPSHOT.jar:na]

      With 1.6:
      java.lang.ClassCastException: cannot assign instance of java.lang.StackTraceElement to field java.lang.Throwable.cause of type java.lang.Throwable in instance of org.apache.logging.log4j.core.impl.ThrowableProxy
      at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2034) ~[na:1.6.0_32]
      at java.io.ObjectStreamClass.setObjFieldValues(ObjectStreamClass.java:1207) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1952) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) ~[na:1.6.0_32]
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) ~[na:1.6.0_32]
      at de.huxhorn.lilith.engine.impl.eventproducer.AbstractStreamEventProdceiverRunnable.run(AbstractStreamEventProducer.java:83) ~[de.huxhorn.lilith.engine-0.9.43-SNAPSHOT.jar:na]

      Tested with both 1.6 and 1.7 on either sending and receiving side, all combinations. Always the same exception.
      I suspect there may be some serialVersionUID snafu somewhere.

        Activity

        Hide
        Joern Huxhorn added a comment -

        Works, thanks!

        Show
        Joern Huxhorn added a comment - Works, thanks!
        Hide
        Ralph Goers added a comment -

        I was able to duplicate the issue and found that SerializedLayout needed to call ObjectOutputStream.reset). This has been resolved with revision 1431560. Please verify and close.

        Show
        Ralph Goers added a comment - I was able to duplicate the issue and found that SerializedLayout needed to call ObjectOutputStream.reset). This has been resolved with revision 1431560. Please verify and close.

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Joern Huxhorn
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development