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(StateManagerImpl.java:1738)
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl$PageState.<init>(StateManagerImpl.java:1514)
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl._saveStateToCache(StateManagerImpl.java:356)
at org.apache.myfaces.trinidadinternal.application.StateManagerImpl.saveView(StateManagerImpl.java:230)
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
Truncated. see log file for complete stacktrace
Caused By: java.io.NotSerializableException: oracle.adf.view.rich.event.Target
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
at java.util.ArrayList.writeObject(ArrayList.java:742)
at sun.reflect.GeneratedMethodAccessor944.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
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 “oracle.adf.view.rich.Target” 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