primefaces: org.primefaces.model.UploadedFileWrapper throws NotSerializableException

1) Environment

  • PrimeFaces version:
    • from 5.3.RC1 and all later versions
  • Does it work on the newest PrimeFaces version?
    • NO
  • Application server + version:
    • Tomcat 8.0
    • myfaces 2.2.8
    • Springframework 3.2.8.RELEASE
    • Spring web flow 2.4.2.RELEASE
  • Affected browsers:
    • All

2) Expected behavior

File upload should work as expected

3) Actual behavior

NotSerializableException occurs

4) Steps to reproduce

Simple file upload.

5) Sample XHTML

Sorry, preparing the sample was kind of difficult, but I’ve found the problematic spot and have suggested a solution. Please read the following discussion.

6) Sample bean

N/A


When I tried to upgrade Primefaces 5.2 -> 5.3 (No other code touched, only Primefaces upgrade) for my project, I’ve met this issue.

This problem might occur on code with Spring Web Flow, but that is just a guess…

After some track-down, I’ve found the specific commit 972eac8 causes the problem in my project.

By making UploadedFileWrapper class implement Serializable interface, the exception was gone.

-public class UploadedFileWrapper implements UploadedFile, FacesWrapper<UploadedFile>, StateHolder {
+public class UploadedFileWrapper implements UploadedFile, FacesWrapper<UploadedFile>, StateHolder, Serializable {

I’m not sure it’s a correct solution, but shouldn’t UploadedFileWrapper implement Serializable interface?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (15 by maintainers)

Commits related to this issue

Most upvoted comments

FWIW, I decided to set the state saving to server and I think it might actually be an improvement for us. We have some pages with several form tags which increases the payload size/load times with client-side state saving.