Hello All:
Please excuse my ignorance, I'm trying to achieve clustering with Tomcat
5....I've read the following in the Tomcat 5 documentation:
========================================================================
=====
To run session replication in your Tomcat 5 container, the following
steps should be completed:
-->All your session attributes must implement java.io.Serializable
========================================================================
=======
Okay. I've completed all the other steps (uncomment the <Cluster>
element along with the <valve>, and added the <distributable/> in
web.xml)........I'm trying to code a simple object that implements
java.io.Serializable to store in a session and here it is.....
package com.shawmut.session;
import java.io.Serializable;
public class SerializeSession implements Serializable {
public static String testString = "";
public void setString(String stringValue){
this.testString = stringValue;
}
public String getString(){
return this.testString;
}
}
ok.....Now I want to put this in the session.....
<%
if(session.getAttribute("ss")== null){
SerializeSession ss = new SerializeSession();
ss.setString("Booooooooooooooo! And I created my
session on Tomcat 1 Node");
session.setAttribute("ss", ss);
}
%>
Whats going on here?.....I unplug the patch cord ( docs says it's a bad
idea) from one of the boxes and hit a jsp on the working node that does
the following......and the session doesn't carry over to the working
node....
<%
if(session.getAttribute("ss")!= null){
SerializeSession ss2 =
(SerializeSession)session.getAttribute("ss");
%>
SESSION:<%=ss2.getString()%>
<%
}
%>
Basically what I'm looking for is an example of serializing session
attributes as noted above.... Any Help here will be greatly
appreciated......
Russ