ADF 12C Target tag not working (ZIP_STATE_FAILED)

Recently I found out that the highly usefull af:target tag did not work for me in my project. At first glance it seemed to simply do nothing however after consulting the logs I found the following exception:

java.lang.RuntimeException: ZIP_STATE_FAILED at org.apache.myfaces.trinidadinternal.application.StateManagerImpl$PageState._zipToBytes(
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl$PageState.<init>(
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl._saveStateToCache(
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl.saveView(
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(
Truncated. see log file for complete stacktrace
Caused By:
at java.util.ArrayList.writeObject(
at sun.reflect.GeneratedMethodAccessor944.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
Truncated. see log file for complete stacktrace

After some digging I found this is because of the “org.apache.myfaces.trinidad.COMPRESS_VIEW_STATE” context parameter. The framework is unable to serialize the “” class when it tries to compress it. I filed a service request with Oracle and the bug has been recognised. However, for now the quick fix is to simply set the “org.apache.myfaces.trinidad.COMPRESS_VIEW_STATE” context parameter to “false” in the web.xml. Now the tag works as expected.

Update: After talking to oracle support they claim the property is not supposed to be a “true/false” but a “on/off” value.  When setting the property to “on” or “off” the problem seems solved, however I am personally not sure whether the compression actually is enabled. Also when Jdeveloper generates the property it is also a “true/false” value…

Hope this might help you on your upcoming ADF 12C endeavours!

Until next time