«

Oct
07

JSF1095 with Glassfish 3.1

After I’ve learned about the new Flash scope before a while, I was often f***** by “JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash.  Any values stored to the flash will not be available on the next request.“.

After reading all (I think around 15) Pages that google has found about this error, I still had no solution. Some of them thought, it is a RichFaces issue, the other say’s its a PrimeFaces, and so on. But after constructing a lot jsf pages, hoping to find a hint about where the failure comes from, the last idea I had, was debugging through the jsf-impl and glassfish :(

And there it was: Glassfish chunks the output stream, where each chunk is commited separately. And it looks for me, as if the ELFlash implementation “thinks”, that the complete output is commited after the first chunk was commited, so it gives the message. (while debugging the first chunk was commited after writing the text of an h:outputText component)

The (for me) 100% working solution, was to disable chunking in the glassfish config. This can be done in the admin console via Configuration -> [server-config] -> Network Config -> Protocols -> http-listener-x.

If this is really correct, it also explains, why it was so hard to build a minimal project to reproduce it. If you have a xhtml file blown up with richfaces/icefaces code and ran into the issue, you’ve removed the must from this code to target the problem. And after it works, it seems to be clear, that richfaces/icefaces is the evil part. But by removing nearly the whole code, the file was simply to small to cut it into chunks.

Perhaps this will help you too :)

Greets from germany
Dirk

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>