[ 
https://issues.apache.org/struts/browse/WW-2803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46055#action_46055
 ] 

Wes Wannemacher commented on WW-2803:
-------------------------------------

I'm not sure if it will be possible to make StrutsRequestWrapper serializable. 
This is a tricky problem... The TokenSessionStoreInterceptor attempts to store 
the entire invocation context into the session so that it can be loaded when an 
invalid token is presented. I can't think of a good way to make this work in a 
way that allows replication across servers. The struts request wrapper is 
mostly just HttpServletRequestWrapper which delegates almost all calls to the 
HttpServletRequest. HttpServletRequest can't be serialized... Making 
StrutsRequestWrapper serialized will compile, but I don't think it will work 
because the HttpServletRequest in the StrutsRequestWrapper is just a reference. 
Deserializing on another server will likely fail... 

As a workaround, you may have to use the regular TokenInterceptor, since the 
only thing it stores in the session is the token. 

> TokenSessionStoreInterceptor - puting non Serializable objects in the Session
> -----------------------------------------------------------------------------
>
>                 Key: WW-2803
>                 URL: https://issues.apache.org/struts/browse/WW-2803
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.0.11
>         Environment: - CentOS Linux
> - Tomcat 6.0.16
> - Struts 2.0.11
>            Reporter: Juliano Carniel
>            Priority: Critical
>             Fix For: 2.1.7
>
>
> I haven't found any issues for this, neither on the mailling lists, so i'm 
> opening one.
> I'm  intercepting an Action with the TokenSession Interceptor, it works fine, 
> but it is saving a non Serializable object 
> (org.apache.struts2.dispatcher.StrutsRequestWrapper) on the session, so in a 
> tomcat cluster environment the session cannot be serialized and sent to the 
> other machine.
> The class that is been saved in the session is the below:
> org.apache.struts2.util.InvocationSessionStore$InvocationContext on the 
> "extraContext" attribute inside this class
> The DeltaManager is complaning about StrutsRequestWrapper, and indeed it is 
> not serializable. Could it be made Serializable? Or it is not suposed to be?
> There's a full stackTrace:
> Sep 12, 2008 2:12:57 PM org.apache.catalina.ha.session.DeltaManager 
> requestCompleted
> SEVERE: Unable to serialize delta request for sessionid 
> [3A52D19C6BC693E3B2C388EC050439DF]
> java.io.NotSerializableException: 
> org.apache.struts2.dispatcher.StrutsRequestWrapper
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
>       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>       at java.util.HashMap.writeObject(HashMap.java:1001)
>       at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>       at 
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>       at 
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>       at 
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>       at 
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>       at 
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>       at 
> java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1509)
>       at 
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1474)
>       at 
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>       at java.util.HashMap.writeObject(HashMap.java:1001)
>       at sun.reflect.GeneratedMethodAccessor126.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       at 
> java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:945)
>       at 
> java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1461)
>       at 
> java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1392)
>       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1150)
>       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
>       at 
> org.apache.catalina.ha.session.DeltaRequest$AttributeInfo.writeExternal(DeltaRequest.java:374)
>       at 
> org.apache.catalina.ha.session.DeltaRequest.writeExternal(DeltaRequest.java:272)
>       at 
> org.apache.catalina.ha.session.DeltaRequest.serialize(DeltaRequest.java:287)
>       at 
> org.apache.catalina.ha.session.DeltaManager.serializeDeltaRequest(DeltaManager.java:633)
>       at 
> org.apache.catalina.ha.session.DeltaManager.requestCompleted(DeltaManager.java:1108)
>       at 
> org.apache.catalina.ha.tcp.ReplicationValve.send(ReplicationValve.java:548)
>       at 
> org.apache.catalina.ha.tcp.ReplicationValve.sendMessage(ReplicationValve.java:535)
>       at 
> org.apache.catalina.ha.tcp.ReplicationValve.sendSessionReplicationMessage(ReplicationValve.java:517)
>       at 
> org.apache.catalina.ha.tcp.ReplicationValve.sendReplicationMessage(ReplicationValve.java:428)
>       at 
> org.apache.catalina.ha.tcp.ReplicationValve.invoke(ReplicationValve.java:362)
>       at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
>       at 
> org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:879)
>       at 
> org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:719)
>       at 
> org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2080)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>       at java.lang.Thread.run(Thread.java:619)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to