Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2865

ErrorPageWriter fails with NotSerializableException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1
    • 2.0.2
    • JSR-314
    • None
    • Java 6u20, Tomcat 6.0.20

    Description

      My application is configured this way:

      If the ErrorPageWriter creates an error page and a non-serializable bean is in the view scope, the ErrorPageWriter fails with the following exception:

      java.io.NotSerializableException: <one.of.my.beans>
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at java.util.HashMap.writeObject(HashMap.java:1001)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
      at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1338)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1146)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
      at org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtils.java:273)
      at org.apache.myfaces.renderkit.ErrorPageWriter._writeComponent(ErrorPageWriter.java:642)
      at org.apache.myfaces.renderkit.ErrorPageWriter.debugHtml(ErrorPageWriter.java:283)
      at org.apache.myfaces.renderkit.ErrorPageWriter.debugHtml(ErrorPageWriter.java:250)
      at org.apache.myfaces.renderkit.ErrorPageWriter.handleThrowable(ErrorPageWriter.java:417)
      at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:274)
      [...]

      This exception completely masks the primary exception that caused the ErrorPageWriter to jump in. This makes it very difficult to find the root cause of the problem.

      The current workaround is to disable the MyFaces error handler by setting org.apache.myfaces.ERROR_HANDLING to 'false'.

      Attachments

        1. MYFACES-2865.patch
          1 kB
          Christian Kaltepoth

        Activity

          People

            lu4242 Leonardo Uribe
            chkal Christian Kaltepoth
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: