Search code examples
javajsfjbossseamlanguage-translation

facelets.viewhandler Error Rendering View NotSerializableException: eu.jakubiak.jpa.translator.Translator$TranslatorProxyMethodInterceptor


I'm working on fixing a bug with a previously existing application using:

  • Java 6
  • JBoss 4.2.3 GA
  • JBoss Seam 2.2.0 GA
  • JSF2

The application leverages this library for translation

http://code.google.com/p/jpa-translator/

http://code.google.com/p/support/wiki/WikiSyntax#Introduction

Are you familiar with this error when trying to post a property of an entity bean to a JSF view?

ERROR [facelets.viewhandler] (http-...) Error Rendering View[/public/answer.xhtml]
java.io.NotSerializableException: eu.jakubiak.jpa.translator.Translator$TranslatorProxyMethodInterceptor

I my code had this

<c:forEach var="_d" items="#{indicatorValuesDimension}">
<s:div styleClass="answer-dimension">#{_d.key.name}</s:div>

Where the indicatorValuesDimension is a java.util.Map, the key is an @Translatable entity bean and name is an @Translate String property.

But if I do this instead it runs just fine...

 <c:forEach var="_d" items="#{indicatorValuesDimension}">
 #{_d.key.name}

So the same expression runs fine outside any JSF tag but throws NotSerializableException when used inside a JSF tag.

Has anyone come across this before? Any pointers?


Solution

  • Solved by switching to

    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    

    in my web.xml. Using

    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>client</param-value>
    

    was causing the problem because many classes in the library (BeanReflector?, TranslatorProxyMethodInterceptor?, etc) do not implement java.io.Serializable.