views:

236

answers:

3

i am currently struggling with HTTP Session replication on tomcat with complex objects.

some objects implement Serializable but hold non-serializable members.

unfortunately, the stacktraces do not provide much useful info here by default.

there is a flag -XX:???? to enable verbose class names in the stacktrace when a NotSerializableException occurrs. this flag would help me a lot finding the source of the error. but i forgot its name

what is the name of the flag?

A: 

I'm not sure that what you're asking for exists - check out Sun's list of VM options, whereby a grep for "seri" only turns up -XX:-UseSerialGC.

Andrzej Doyle
A: 

I am not aware of such a flag, but I don't think more verbose stack traces will help.

The name of the class that is not serializable normally appears in the exception message, e.g. "java.io.NotSerializableException: com.mycompany.mypackage.Foo"

The stack trace shows what methods were executing at the time, usually something like:

at java.io.ObjectOutputStream.writeObject0(Unknown Source)
at java.io.ObjectOutputStream.writeObject(Unknown Source)

But any extra information about those methods will not tell you what class caused the problem.

finnw
+4  A: 

-Dsun.io.serialization.extendedDebugInfo=true

Andreas Petersson
I need to wait 2 days before i can mark this as accepted, due to SO rules. i found the answer at http://mfondo.blogspot.com/2007/10/java-serialization-debugging.html
Andreas Petersson