[jboss-user] [JBoss Seam] - NotSerializableException:ThreadLocal when using PAGE scope
raghinii
do-not-reply at jboss.com
Wed Jan 31 23:43:21 EST 2007
Hello all.
I'm porting the display side of an existing EJB3 backed webapp to
Seam w/ JSF/Facelets and EJB3 on Jboss AS.
( jboss 4.0.5GA w/ Seam 1.1.1GA )
A few pages are working front to back so the plumbing is at least generally functional.
The current issue is that i have a Seam managed bean (pojo) into which is injected another pojo that has a SESSION scope.
Things work fine if my first object is event scoped or session scoped, but if i change the scope to "PAGE" then i get this serialization Exception.
is this supposed to work ?
| javax.faces.FacesException: java.io.NotSerializableException: java.lang.ThreadLocal
| at org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtils.java:190)
| at org.apache.myfaces.shared_impl.util.StateUtils.construct(StateUtils.java:150)
| at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.writeState(HtmlResponseStateManager.java:102)
| at org.apache.myfaces.application.jsp.JspStateManagerImpl.writeState(JspStateManagerImpl.java:430)
| at org.jboss.seam.jsf.SeamStateManager.writeState(SeamStateManager.java:66)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:599)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at com.pimp.servlet.BrandRedirectFilter.doFilter(BrandRedirectFilter.java:80)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.io.NotSerializableException: java.lang.ThreadLocal
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
| at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
| at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
| at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
| at java.util.ArrayList.writeObject(ArrayList.java:569)
| at sun.reflect.GeneratedMethodAccessor198.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
| at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
| at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
| at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
| at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
| at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
| at java.util.HashMap.writeObject(HashMap.java:1039)
| at sun.reflect.GeneratedMethodAccessor202.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:917)
| at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1339)
| at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
| at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1251)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
| at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1251)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
| at java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1251)
| at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1075)
| at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
| at org.apache.myfaces.shared_impl.util.StateUtils.getAsByteArray(StateUtils.java:180)
| ... 32 more
|
also, is this mention of JspStateManager in the stacktrace a concern given that JSPs aren't supposed to be involved here at all ?
| org.apache.myfaces.application.jsp.JspStateManagerImpl.writeState(JspStateManagerImpl.java:430)
|
Here are the classes in my stripped down test case.
the bean that's injected:
| @Name("loginSessionFoo")
| @Scope(ScopeType.SESSION)
| public class TestSessionScoped implements Serializable {
|
| @Logger
| private Log log;
|
| private String foo;
| public String getFoo() {
| return foo;
| }
| public void setFoo(String foo) {
| this.foo = foo;
| }
|
| }
|
the one into which it is injected
| @Scope(ScopeType.PAGE)
| @Name("contentDisplay")
| public class ContentDisplay implements Serializable {
|
| @Logger
| private Log log;
|
| private Date oneDayAgo;
|
| @In(value="loginSessionFoo", create=true)
| private TestSessionScoped foo;
|
| /**
| * Currently acts only to give out a date 1 day ago today to see
| * that's used for display calculations.
| *
| */
| //CHECK does this still seem like a good idea
| @Create
| public void initialize() {
|
| Calendar cal = new GregorianCalendar();
| cal.add(GregorianCalendar.DAY_OF_YEAR, -1);
| this.oneDayAgo =cal.getTime();
| }
|
| // some action methods removed....
| }
|
any pointers appreciated. thanks.
radu
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4009197#4009197
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4009197
More information about the jboss-user
mailing list