2

In a production application that I have developed sometimes I get an error saying .getDocument() is null. I have added checks in my code that traps an error if this happens. And the strange thing is that the XSPDocument seams to be OK.

Any other ideas how to debug the cause of this?

========================================================

Edit

The lower parts of the application is a simple database, create an assignment it gets status new change the status to ongoing thru a button. Add information in text, date and numberfields, no Richtext, no attachments.

The user can switch to another xpage to send this document is an pdf attachment in an email.

The user can save the document as a draft

When they are done the click on an approve button and this button will set the status to approved. Save the document and send it as an pdf to an email adress

The problem ocurrs both on the Save button and on the approve button.

.getDocument from the xsp document is null the xspdocument.getNoteID return an ID I can do replaceitemvalue on the xsp document. It never happens on new documents only existing what I have seen

It feels like the comment from David that the backend doc is dropped/recycled

Fredrik Norling
  • 3,461
  • 17
  • 21

3 Answers3

0

Hard to give a hint without knowing more about everything else, but I remember having seen this as well. Just a few ideas: Is XSPDocument.getNoteID() pointing to a valid Document if this happens? Is it maybe pointing to a different doc than what you expected? Could there be some kind of dynamic change of datasources going on? Maybe some kind of timeout so that the server all of a sudden forgot who you are (in rare cases this happens to me)? Lothar/edcom

Lothar Mueller
  • 2,528
  • 1
  • 16
  • 29
0

we experienced the same getDocument() problem recently. Finally we found a root cause: two different XPages were loaded simultaneously via iFrames. One of those XPages produced run-time error randomly, in 25% of cases. A sort of conflict in JSF model in context of single session.

solution: viewState="nostate"

not sure if it helps in your case, but this option resolved a lot of problems in our applications. It was introduced in 8.5.3. And it should be especially useful for so called XAgents.

Denny
  • 161
  • 2
0

It would be helpful to have a few more details. I assume that the document has previously been saved and it's not a new note?

You're not trying to put the actual document object inside a scoped variable are you? That would be bad as that would be pretty toxic. Without knowing more I would think this could be the case. The backend document has been garbage collected.

David Leedy
  • 3,583
  • 18
  • 38