• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problems disabling Session Persistence Manager in Tomcat

 
Egil Poma
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic