One of the basic challenges of XPages development is how to effectively conduct initial tests on the applications you build. Unlike classic Notes development, where each change can immediately be seen in both local and server-based applications, XPages require a build & compile process in order to see the results of your work. Even in the case of classic Domino development for web browsers, it is still possible to see somewhat accurate results with the built-in preview capabilities of Designer.
However because XPages have their origins in Java Server Faces (JSF), and are closely bound to the run context of the Domino server, it is much more difficult to see what resulting behavior is in any other context than a running Domino server.
Let’s look at the options available today…
From the application design, select “Preview in Notes.” This activates the XPages-in-Notes-Client (XPiNC) interface for the application and displays it inside the Notes client itself. There are two basic problems with this rendition of the page: 1) the embedded XPages client is actually XULRunner 1.9.2, which is the equivalent of Mozilla Firefox 3.6, released in January of 2010 and officially out of support in April of 2012; 2) when running in the Notes client, the XPages servlet engine is executing within the context of the Eclipse framework, accessing HTTP content through an extended-port loopback connection, even when the NSF being viewed is itself on a server. This servlet does not support user credentials, nor does it have any of the plugins, databases or other runtime capabilities of an actual Domino server.
In a local NSF, select “Preview in Web Browser” from the application design. This again activates a local Domino server, this time listening on the HTTP-standard port 80. This local server does not support user credentials, so the application can only be viewed as Anonymous, and again does not have any of the runtime capabilities of an actual Domino server.
In a server-based NSF, select “Preview in Web Browser” from the application design. This approach will, at last, present a preview experience based on the code executing on the Domino server. Unfortunately, this may or may not represent the change that the developer intended, depending on whether he remembered to perform the Build command after saving his changes.
Of course, one way to work around this is to turn on the “Build Automatically” switch in Designer. This switch causes XPages applications to be built & compiled after each save of a relevant design element. While this might sound like a great convenience, it turns out that in real world applications, it can be prohibitively expensive, particularly when saving a change to a database on a remote server.
Additionally, let’s suppose that the server housing the NSF is a typical development server that might be shared by several developers at once. When the page is previewed and run on the server, it is then executing the code in the server’s context, which means it has the opportunity to affect all the other developers as well. Even a simple accidental loop can trigger a server hang and force a restart of the http service or even the entire server. All other developers must stop work until this restart is complete.
So local previews within the Notes client are not accurate renditions of Xpages. Web previews of local NSFs are not accurate. Web previews of remote server NSFs are accurate, but require lots of bandwidth, are fragile in practice, and can significantly reduce productivity of developers.
What, then, is the solution? Our recommendation at Red Pill is for each developer to run a local Domino server dedicated to hosting local versions of their applications. This gives them the ability to:
- Point Domino Designer to the local server for their design versions;
- Leave Build Automatically turned on, since they will have guaranteed high bandwidth throughput to the local server;
- Recover easily from catastrophic smoke test failures such as infinite loops or out of memory errors;
- Login as different users to test aspects of the application;
- Easily add OSGi plugins to the server for testing of advanced capabilities like the Xpages Extension Library;
- Easier access to error and trace log files for diagnostics.
This Domino server can be in the native operating system or in a hosted VM.
This is the standard development approach for other platforms such as Jboss, Websphere and Tomcat. And IBM recently announced at the IBM Connect conference that it will soon be releasing a developer virtual machine image to support exactly this mode of operation.