A user opens an XPage with a document, no problems. After several minutes of inactivity on the page, s/he saves the page (simple action). The result is that the document is reopened for some reason and then saved. The reopen effectively undoes all modifications applied by the user. In our logs we can see this happening, but we have no explanation.
Our conclusion is that apparently the document in memory gets "lost" or discarded somehow, but why? Which timeout has this effect? How can we change it?
Thanks for your help!
It sounds like a page persistence issue. Have a look at this answer: "Xpage document is not saved if opened for some time"
Related
If any document remains opened for some time (example 10 mins or more) in edit mode and then tried to save after that then save is discarded and document is just refreshing and opened in read mode. How to prevent this as it causes user to loss the entered data.
It sounds like your page is removed from the list of stored pages. XPages stores a limited number of pages in either memory or on disk depending on how server page persistence is set up for your application. So my guess is that you are opening other pages from the application in separate browser tabs.
Once you hit the limit pages are removed from the list in order of appearence. This means that XPages has no knowledge of the component tree for the particular page which is no longer stored. This explains why your changes are 'discarded' and why the page is reloaded.
The default number of stored pages is only 4 in 8.5.x and 16 in 9.0.x.
My recommendation is that you increase this number by changing the server page persistence settings on the Persistence tab of Xsp Properties.
You should also be aware of the option to mark specific XPages to not store state by setting the property viewState to "nostate" on the xp:view component. This is useful for readonly pages and for 'xagents' that do not need to store state.
Notice: the keepSessionAlive control will not help here as you need to 'keep the component tree alive' - not the session.
I guess you may have hit a "session timeout".
What I will suggest that you do is to set a long application timeout and a short session timeout - and use a "keep alive" custom control to make sure that the session will not time out while you are editing it.
I have tried to explain some of these features in a blog article that may give you a better overview ;-)
/John
I was playing around with run With Document Context almost the whole day. Maybe someone can help to find me a feasible solution.
If i run the agent in before page load / before render response / query Open Document event i am able to pass values back to the xpage without saving the document. I tried also to save the document but it didnt help.
Beside these two events i didn't find a way to call the agent and bring the values from the lotus notes agent back. Can anybody think of an event that would work?
Calling an agent does work from anywhere you can call SSJS. Some considerations are on my blog.
However there is one big, big caveat: when you try to use a document (saved or unsaved) that is bound to a datasource in your current XPage, then the values in the datasource will overwrite the changes in the backend document. This could be your issue?
As David suggests: use SSJS & Java. It is less work than you might fear and you can pay down some technical debt
How about just creating a new Domino document, put the fields on it that you want to send, call your agent, and then get back those fields. Then populate whatever you need to on the XPage (getComponent("name").setValue(value).
There is no need to save this temporary document and it will just end up going away when your code runs.
Just for reference before mentioning the problem I would like to say that I have asked to same question on IBM Lotus forum(http://www-10.lotus.com/ldd/ndseforum.nsf/xpTopicThread.xsp?documentId=2AD7C8F89D8930E685257BD50022A9E9) and I have not received any reply for the same in last 2 weeks.
So, I have a typical xpage dropdown menu with say around 40-50 leaf nodes, Every leaf node submits a specific value (using submitValue property) which is then evaluated and action is performed. However, the problem is that, after the action is performed if I try to refresh the page i get the browser notification for re-submission (I believe that it is some kind of programming error by me, however I don't know how to resolve it.)
One example to make it more clear:
I have a delete node inside the dropdown. It basically deletes the selected entries from the view(generated using repeat control) and then refreshes the view content. But at this point of time if I try to refresh the page then I get the notification of re-submission by the browser. If I accept it, then it tries to delete it again (which I prevent it but still this shouldn't happen) and if I don't accept it, it just doesn't refresh the page.
Any reply would be appreciated.
Thank you in advance. Hoping to hear some suggestions. (Please let me know if event he code is required)
I believe you need to implement the Post/Redirect/Get pattern to avoid re-posting on refresh.
Here's a solution by Tommy Valand for XPages for that pattern: http://dontpanic82.blogspot.dk/2010/06/xpages-avoid-saving-duplicate-documents.html
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
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.
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
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.
i am new in ms access. Now i have to finish some modifications in ms access 2003. I am getting this error "you do not have access to the database this time. If you proceed to make changes,you may not be able to save them later". Please help me to solve this problem.
Microsoft has documented the problem, but the sugested solutions were completly unusable in most of my situations. Furthermore the issue occurs even in a split database and it occurrs inconsistently with forms and controls that use code. In my opinion MS got this wrong or at the very least documented incompletly.
Here is my solution:
The problem in many instances traces back to Access thinking the DB is in an exclusive mode, when it should be in a shared mode. Setting the DB to "shared mode" under Options doesn't help, because it will revert back to "exclusive" any time a user turns on the "design view" for any object in the database OR makes code modifications OR if a user presses "save" (CTRL + S)!
In order to prevent the error message from poping up, you need to prevent the users from pressing "save" or switching to "design view" in your DB. I have deleted the save button in the Quick Access Toolbar (so users don't see it) and under Options>Current Database I have unchecked "Allow Full Menus". Additionally you can also uncheck "Enable Layout View" in the same menu.
Possibly the Save function can be disabled alltogether, but I have not yet written code for this. This solution is not fool proof, but it greatly reduced the occurence of the problem in my various split and unsplit DBs.
I was getting this error in ms-access-2010 just the other day. I was working with a method in vb to query the db. I needed to commit my transactions and close the database object after I was done with it at the end of the method. This fixed the problem for me.
This occurs in Access 03 when you are not the only live user present in the .mdw (security) file, if this is a shared database then before making any changes you will need all other users to log out and then to ensure this error doesn't occur again, always open the database in 'exclusive' mode for editing, this is achieved by selecting the little arrow on the open button.
However, you can also have some strange behaviour with .mdw files, if you are genuinely the only user logged in, then I would suggest first logging out, manually deleting the .mdw file if it exists and then going back into the database.
Always open the database in "exclusive mode" when programming and this will never happen.