Recently I’ve been working on an application for XPages in Notes Client. Part of that has been using Domino Data Services in the application. One of the problems I came across was that the Domino Data Service was not running as the current logged on user, even though I was calling it from Java. I needed to pass credentials.
But even when passing the credentials, it was not working on a local XPiNC application. Instead it was throwing an ECL security exception, even though the signer had the new “Load Java code” ECL setting enabled. The solution for me was to use the “Run server-based XPages apps directly on server” setting.
For those who haven’t used it, it’s a two-step process. Not only does the property need to be enabled on the Launch settings of the Database Properties, but the application needs to be added in the Notes Client preferences, on the XPages Performance tab, with the relevant server host name. If a host name is not used, it appears to try “www.” + server name + “.com”
For performance purposes, at the same time and on the same XPages Performance tab in the Preferences, I enabled the application and the relevant home page in the “Preload XPages in the following applications”.
All well and good, until today. I made a change, opened the application in XPiNC and got an Error 500. So I closed down Notes and restarted, to ensure it was fully reloaded. When I did, Notes started running slowly, so much so that after a few seconds Notes had stopped responding. After killing and restarting Notes, the same ensued. After rebooting my PC and starting Notes, again, the same happened.
So I started looking at troubleshooting.
In Domino Designer’s Preferences, on the General tab, there is a check box for “Show heap status”. This shows memory usage and allows you to start garbage collection. However, the setting does not persist across sessions, so you need to enable it each time you start Designer. Fortunately, after starting Notes I had time to start Designer and enable the setting. What I then found was the Java memory kept increasing, passing my starting threshold of 256, up to my maximum of 512, at which point Notes hung. All before I had opened any applications. Repeating a few times, the same thing occurred, Garbage collection had no impact.
At this point I remembered the preloading setting, opened preferences quickly and turned it off. Sure enough, Notes worked fine. The application still wasn’t working, but Notes was.
So I continued troubleshooting, looking at the xpages.log file in <Notes>dataIBM_TECHNICAL_SUPPORT, the error stack trace explained everything:
3/12/14 10:51 AM: Internal warning: Check access being called outside of a request
3/12/14 10:51 AM: Internal warning: Check access being called without a valid session/database
3/12/14 10:53 AM: Exception Thrown
javax.servlet.ServletException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at com.ibm.domino.xsp.module.nsf.NSFService.doService(Unknown Source)
at org.openntf.domino.xsp.adapter.OpenntfHttpService.doService(Unknown Source)
at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(Unknown Source)
… 18 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.lang.String.substring(Unknown Source)
Yes, there was an XPages error occurring on the page being pre-loaded and, in this scenario, the error was being compounded by an attempt to do substring on the first element of an array that was blank.
There are a number of lessons learned here and the problem was solved more quickly by knowing how to troubleshoot the problem. But my main learning point has been to switch off preloading of XPages applications while developing.