> -----Original Message----- > From: Karr, David > > I'm using JDK 1.4.1, and Tomcat 4.1.24. > > I was seeing a strange situation where some cactus/ant tests of mine > would succeed on one run, and then fail on the next, and alternate in > that pattern continuously. > > After looking carefully at the Tomcat logs, I discovered that a class > that is instantiated and then put into the session has a Log4J Logger > object. Tomcat tries to persist that session, but it fails because > Logger is not serializable. > > If I want to allow objects of this class to be serialized and > deserialized, how do I deal with the contained Logger object?
Ok, making the "Logger" variable static is an easy fix for this. However, I'm now seeing another problem related to the serialization and deserialization of this class. I see that (I didn't write this code) this class has a static initializer that calls an accessor to read something that is created in the "init()" method of the servlet related to this class. Normally, the servlet's "init()" method is executed (load-on-startup), and then later this class is loaded, making those references safe. However, when Tomcat loads serialized sessions, it loads these classes before loading servlets. This causes my reloaded session to fail. It seems pretty clear to me that the logic needs to be changed so that the accessor (on a null check) should call the same method that the servlet's "init()" method calls, to deal with the case that this accessor is called before the servlet is inited. However, I would ask, is it expected that Tomcat will load serialized sessions before loading the "load-on-startup" servlets? --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
