Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make the session data serializable

Previously we have implemented sticky session.

Here's the link on our environment: Sticky Session in apache doesn't work

Our next task is to implement session replication.

We are current using tomcat example, cart.jsp to demonstrate this behavior.

It is said that all session attribute must implement java.io.serializable.

Do you have any tips on where to implement it? We are following this tutorial closely.

tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

like image 899
Wen Jun Avatar asked Oct 15 '25 03:10

Wen Jun


1 Answers

java.io.Serializable is a so-called marker interface. It contains no methods. So to make objects of some class serializable you don't have to implement anything. Simply add Serializable to the list of interfaces you class implements.

i.e.:

class MyClass implements Serializable {
}
like image 100
aav Avatar answered Oct 16 '25 23:10

aav



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!