Java flag to enable extended Serialization debugging info
Asked Answered
M

1

30

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?

Marden answered 2/11, 2009 at 10:19 Comment(2)
By session, do you mean a Servlet HttpSession?Dinosaurian
yes. HttpSession must only contain serializable objects or else it won't persist restart and won't be able to be replicated to other tomcat nodes..Marden
M
62

-Dsun.io.serialization.extendedDebugInfo=true

Marden answered 2/11, 2009 at 10:56 Comment(4)
I need to wait 2 days before i can mark this as accepted, due to SO rules. i found the answer at mfondo.blogspot.com/2007/10/java-serialization-debugging.htmlMarden
It's probably worth mentioning that this flag only kicks in when there is a serialization problem, as a result the logs won't go crazy before the event occurs.Mosa
@AndreasPetersson where to set this? like I am using tomcat serverLid
@Lid The command line for starting Tomcat. It's a Java parameter, so it needs to be placed into the java command.Mosa

© 2022 - 2024 — McMap. All rights reserved.