File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Problems disabling Session Persistence Manager in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problems disabling Session Persistence Manager in Tomcat" Watch "Problems disabling Session Persistence Manager in Tomcat" New topic
Author

Problems disabling Session Persistence Manager in Tomcat

Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
I'm running Tomcat 5.5.17. I've been working on an application for quite some time when the tomcat logs suddenly started to fill up with the following errors each time I restart Tomcat:

2006-09-29 21:15:10,539 | WARN | StandardSession.java | writeObject() | 1468 | Cannot serialize session attribute publicPictures for session 9184A48FEFC99FAA3573A4DE1F75CCD5

I've searched the web, and found out that the reason for this is that Tomcats "Restart Session Persistence" is turned on. So how do I turn that off?

According to a few sites in the web there should be a file called application.xml, in which I can put the line <Manager pathname=""/> to disable the Session Persistence manager. The problem is that on my Tomcat installation there's no such file.

So I tried to create the file $CATALINA_HOME/conf/application.xml



But this had no effect at all. So can someone please explain to me how I can disable the Session Persistence manager?
[ September 29, 2006: Message edited by: Egil Poma ]
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
I've searched the web, and found out that the reason for this is that Tomcats "Restart Session Persistence" is turned on. So how do I turn that off?


Nope, that is not the reason you are getting that error. Servlet containers are allowed to serialize a session to disk any time they want - presumably for memory management. Thats why all objects referenced in a session should be serializable.

Presumably your instance of Tomcat has decided to serialize sessions because memory is getting tight. The simplest thing to do would be make that class serializable (if possible).

Bill
Egil Poma
Ranch Hand

Joined: Nov 23, 2002
Posts: 40
Are you sure about that? According to i.e. this thread on the Sun forum, it should be possible to turn of the Persistent Manager:
http://forum.java.sun.com/thread.jspa?threadID=575302&messageID=2870473

I don't really want to change my code just to please a strange behaving servlet container. It would also make no sense to others who may read the code that suddenly one of the classes, seemingly for no reason, is serializable.

So if it is indeed as you say, the only way to get around this problem is to buy more memory?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Egil Poma:
... It would also make no sense to others who may read the code that suddenly one of the classes, seemingly for no reason, is serializable. ...


It should make perfect sense to anyone who calls themself a servlet developer.

There are other reasons why objects bound to session (directly or indirectly) would need to be serializable. For instance, in a clustering environment, Tomcat (and many other containers) will replicate session data over TCP/IP by serializing the objects bound to session.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
You should be able to configure Tomcat so that it does not try to serialize sessions on shutdown with an attribute in the server.xml <Host tag.
expireSessionsOnShutdown="true"

That is not going to prevent Tomcat from deciding to serialize a session during normal operation.

This page at the Tomcat site appears to cover configuration related to the persistance manager. It looks like if you don't specify a Manager for a Context you get the default one.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems disabling Session Persistence Manager in Tomcat