0

I'm kind of desperate. We have a lot of code, and we also have a lot of variables of which many are inside viewScope and other HashMaps. Every now and then we get the error that some DateTime object cannot be Serialized. I understand the why, no problem there. But which variable? Which element of the HashMap? Since Serialization happens automatically, out of my control, the problem could be anywhere. It could be a DateTime value the code puts into a viewScope variable (I think I checked them all), it could be my own beans' HashMaps, and it could even be lines with column values from a view. I just don't know...

Can anyone point me into the right direction to find out where that @$@%#! exception really occurs? For instance: can the stack trace be more informing about which HashMap it found the problem in, and maybe even which key??

@$@%#! - read: elusive...

D.Bugger
  • 2,300
  • 15
  • 19

1 Answers1

0

One option would be to add a PhaseListener to your application that, in Render Response phase, iterates through all scopes and outputs the key and the output of getClass() for the value. The code could also do the same for the hash maps in the beans.

There are various examples of PhaseListeners on XSnippets.

Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33
  • Paul, could it be a pratical way to create and use an own error page that contains the debug toolbar where the you can see the variables? – Oliver Busse Dec 23 '15 at 08:59
  • That's an option, but if the DateTime is added during a partial refresh and serialization fails, it may be null or missing by the time the error page displays. I've not encountered it before, so I'm not sure what it would do to the scopes by the time of the GET request for the error page. – Paul Stephen Withers Dec 23 '15 at 09:03
  • Sadly, I get other exceptions as well:cannot serialize a JavaScript function. Again: not a clue... Is there some way to test serialization, e.g. using some existing Serializer class? – D.Bugger Dec 23 '15 at 10:59
  • Now reading this: http://stackoverflow.com/questions/3840356/how-to-test-in-java-that-a-class-implements-serializable-correctly-not-just-is – D.Bugger Dec 23 '15 at 11:03
  • Have Xsp Properties persistence settings changed? The "cannot serialize a JavaScript function" will be storing a SSJS function as a variable, e.g. `var myFunc = function() {...` and storing in scoped variable. See http://lotusnotus.com/lotusnotus_en.nsf/dx/serialization-viewscope-and-exploding-xpage-after-upgrade....htm – Paul Stephen Withers Dec 23 '15 at 11:07
  • Ah, progress: 23/12/2015 12:25:40 HTTP JVM: E.L1UD: error serializing viewScope/isAction, java.io.IOException: Impossible de sérialiser une fonction JavaScript [Sjef BOSMAN] – D.Bugger Dec 23 '15 at 12:23
  • I suppose it's this line of code: viewScope.isAction= dominoDocument1.getItemValueString("Form")=="Action"; – D.Bugger Dec 23 '15 at 12:25
  • We used to have all pages in memory, but now we're moving to keep only the current page in memory, hence the serialization. – D.Bugger Dec 23 '15 at 12:27
  • We just found the DateTime bug. It was an Object class variable in a viewScoped bean (private Object value), and the value assigned to it was the value returned by evaluate("@Today"). Well, not exactly, since we use the Extended Formula Language library written by Bert Häßler. Obviously, a DateTime value is returned, and bean serialization failed. Good, one solved, one to go (JS function cannot be serialized). Thanks all! – D.Bugger Dec 29 '15 at 13:28