The original user was having trouble figuring out which class(es) in their application were causing NotSerializableExceptions.
And, in fact, I was starting to think about the Serializable issue for a client...


And then Tim wrote:

------- Additional Comments From [EMAIL PROTECTED] 2004-10-11 22:36 -------
You can determine which attributes are not serializable by writing your own
HttpSessionAttributeListener and checking if the attribute implements serializable.


http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/ servlet/http/HttpSessionAttributeListener.html

This is actually a good idea, Tim :-) So I've written one and will polish it up a bit (it goes recursively, first complaining if the object is not serializable, then testing if the object being added is a Collection...).


Since a number of Tomcat users are not Java programmers, I would like to commit this for general use.

But there doesn't seem a good place for it. What would y'all think of creating a package called, say, o.a.c.userdiagnostic or o.a.tomcat.util.userdiagnostic to serve as a place to store diagnostic tools for end-users? Or is there a good place already?

To be maximally useful it wants to be part of what gets shipped with TC, so we can just tell people something like:

You can do this with an HttpSessionAttributeListener; to use Tomcat's default "serializable attributes" diagnostic HttpSessionAttributeListener just add these lines in your web.xml, immediately before the first <servlet> tag:

<listener>
<!-- Used to warn about non-Serializable objects being put in the session. -->
<listener- class>org.apache.catalina.userdiagnostic.SerializableCheckAttributeListe ner
</listener-class>
</listener>


Ian

Reply via email to