@EJB in @ViewScoped managed bean causes java.io.NotSerializableException

后端 未结 1 1266
轻奢々
轻奢々 2020-12-01 17:14

I\'ve been banging my head around with a @ViewScoped managed-bean. I\'m using primeface\'s \"schedule\" component in order to display some events. When the user clicks on a

相关标签:
1条回答
  • 2020-12-01 17:54

    @ViewScoped beans are stored in HTTP session. Any objects which are stored in the HTTP session needs to implement Serializable. See also JSF managed bean causing java.io.NotSerializableException during Tomcat deployment and java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException.

    The NotSerializableException is usually self-explaining since it mentions the full qualified name of the class which needs to be serialized as well, but can't be since it doesn't implement Serializable.

    However, in this particular case the name seems to indicate an autogenerated class, most likely autogenerated by the EJB container and thus completely out of your control.

    I've never seen this problem before and Google also doesn't seem to give much about this problem. Based on the stacktrace you're using Glassfish v3, so I'd suggest to post an issue about that. In the meanwhile your best bet is probably to set the JSF view state saving to the server side instead.


    Update: a similar problem in MyFaces suggests a JSF impl specific issue of using wrong classloader during deserialization. Upgrading the JSF impl should solve the problem: @EJB in @ViewScoped @ManagedBean causes java.io.NotSerializableException.

    0 讨论(0)
提交回复
热议问题