Bug 52558

Summary: CometConnectionManagerValve is adding non-serializable Request[] to Session
Product: Tomcat 8 Reporter: adam hawkins <adam.hawkins>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: 8.0.0-RC1   
Target Milestone: ----   
Hardware: Macintosh   
OS: All   

Description adam hawkins 2012-01-30 10:46:47 UTC
CometConnectionManagerValve is adding HttpServletRequest[] to HttpSession which is preventing the Session being serialized in a Clustered setup.

We're resolving this locally using a serializable ConnectionList class with a transient Request[]

i.e.

public class ConnectionList implements Serializable {
	
	transient Request[] connectionList = null;
	
	ConnectionList(Request[] connectionList){
		this.connectionList = connectionList;
	}
	
	public Request[] get(){
		return connectionList;
	}
}
Comment 1 Rainer Jung 2012-01-30 10:59:05 UTC
Note that there is an attribute "sessionAttributeFilter" in the cluster manager configuration, that allows to decide which session attributes you want to be replicated. It was introduced in Tomcat 7.0.22.

See:

http://tomcat.apache.org/tomcat-7.0-doc/config/cluster-manager.html

It is not a direct answer to your observation, but might be enough for a workaround. Therefore I keep this issue in status "New".

Regards,

Rainer
Comment 2 Mark Thomas 2013-09-12 11:17:37 UTC
I'd be surprised if anyone was relying on the connection list being stored as an array of requests but in case they are it is safer to use the work=around for 7.0.x and earlier. I have applied a fix based on the suggested new class for Tomcat 8.