Hi-
I have an issue with session persistence that I can't figure out.
I am running:
CentOS 5.2
Tomcat 5.5.23
JDK 1.4.2
I would like my user sessions to be persisted across tomcat restarts.
I would like this to happen using the default write-to-file (SESSIONS.ser)
method of org.apache.catalina.session.StandardManager
It appears that if I try to store a class in the session that contains
anything other than native JDK types, I get a de-serialization error when
the session is loaded after tomcat restarts.
For example, I created the following simple class:
import java.io.*;
public class TestClass implements Serializable {
private int test;
public TestClass() {
test = 1234;
}
public int getTest() {
return test;
}
}
I can put this class directly into the session and it is successfully
serialized and de-serialized across tomcat restarts. This is working just
fine.
However, if I create a containing class for my simple class:
import java.io.*;
public class ContainingClass implements Serializable {
private TestClass testClass;
public ContainingClass() {
testClass = new TestClass();
}
public TestClass getTestClass() {
return testClass;
}
}
I receive the following error upon de-serialization after tomcat restarts:
5-Dec-08 7:02:14 PM org.apache.catalina.session.StandardManager doLoad
SEVERE: IOException while loading persisted sessions:
java.io.InvalidClassException: invalid field type for testClass in class
ContainingClass
at java.io.ObjectInputStream.readClassDescriptor(libgcj.so.7rh)
This behavior is extremely consistent across all of my testing.
Does anyone have any ideas as to why I can't de-serialize classes that
contain non-native JDK types?
Thank you!
-Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]