Al inyectar dentro de mis means @Stateful con scope @ViewScoped (Seam 3 Faces) sale el siguiente error.

Error Rendering View[/vista.xhtml]: java.io.NotSerializableException: org.jboss.weld.bean.SessionBean
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) [:1.6.0_24]
at java.util.concurrent.ConcurrentHashMap.writeObject(ConcurrentHashMap.java:1246) [:1.6.0_24]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_24]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) [:1.6.0_24]
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) [:1.6.0_24]
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) [:1.6.0_24]
at java.util.HashMap.writeObject(HashMap.java:1001) [:1.6.0_24]
at sun.reflect.GeneratedMethodAccessor373.invoke(Unknown Source) [:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) [:1.6.0_24]
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) [:1.6.0_24]
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) [:1.6.0_24]
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518) [:1.6.0_24]
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483) [:1.6.0_24]
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) [:1.6.0_24]
at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1346) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1154) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) [:1.6.0_24]
at java.util.HashMap.writeObject(HashMap.java:1001) [:1.6.0_24]
at sun.reflect.GeneratedMethodAccessor373.invoke(Unknown Source) [:1.6.0_24]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_24]
at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_24]
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945) [:1.6.0_24]
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1469) [:1.6.0_24]
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158) [:1.6.0_24]
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330) [:1.6.0_24]
at com.sun.faces.renderkit.ClientSideStateHelper.doWriteState(ClientSideStateHelper.java:321) [:2.0.3-]
at com.sun.faces.renderkit.ClientSideStateHelper.writeState(ClientSideStateHelper.java:169) [:2.0.3-]
at com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:119) [:2.0.3-]
at com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:155) [:2.0.3-]
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:221) [:2.0.3-]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:406) [:2.0.3-]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:127) [:2.0.3-]
at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:161) [:]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269) [:2.0.3-]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269) [:2.0.3-]
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:269) [:2.0.3-]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:117) [:2.0.3-]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97) [:2.0.3-]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:135) [:2.0.3-]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:309) [:2.0.3-]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:112) [:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:541) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:479) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:407) [:6.1.0.Final]
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:103) [:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
at org.jboss.seam.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:65) [:3.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
at org.jboss.seam.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:72) [:3.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:274) [:6.1.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [:6.1.0.Final]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [:6.1.0.Final]
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181) [:6.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285) [:1.1.0.Final]
at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261) [:1.1.0.Final]
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88) [:6.1.0.Final]
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100) [:6.1.0.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:159) [:6.1.0.Final]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [:6.1.0.Final]
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) [:6.1.0.Final]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [:6.1.0.Final]
at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53) [:6.1.0.Final]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [:6.1.0.Final]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [:6.1.0.Final]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654) [:6.1.0.Final]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [:6.1.0.Final]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]

Mi teoria es que al intentar pasivar los bean (por eso sólo pasaría en los @ViewScoped, aunque en los @ConversationScoped sí funciona…) intenta serializar el proxy al SFSB que, por tanto, debiera ser Serializable. Veamos.

Hacer que los SFSB implementen java.io.Serializable no sirve…
¿Tampoco hacerlos transient en el punto de inyección >>? Eso es freak porque debiese ser suficiente.

En todo caso, había olvidado que tenía seteado guardar la sesión del lado del cliente en el web.xml >>

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

Si le saco esto, el error despararece.

 

Este sitio utiliza cookies.    Leer más
Privacidad