I'm having trouble with this - it seemed to work to start with, but I'm now having problems.
Like you, I am trying to make a global variable of a Notes object (a view in one case and a document in another)
As far as I can see the DataContext variables are subject to the same rule/problem as scoped variables, in that they cannot be domino objects.
I get the page come up correctly the second time I access it (the first time the db path that I need to find them is not set in applicationScope, but I'll worry about that later).
The third and subsequent accesses I get an error:
To get out of this I need to restart the http task on the server.
I did notice that if I set the application properties such that the xpages are all cached in memory the problem goes away. Whilst I'll probably do that for the production system as long as the load is not too high, I'd rather do this properly now to prevent real problems in future.
So do I have to move back to putting them in the beforePageLoad (which like the top question I was going to do originally) or is there something I've missed?