Lotus Notes FAQ Visit Our Sponsor!

How do you set up Gnu JSP and Tomcat?

From Calin_Tenitchi@netset.se:

The servlet manager in Domino has the following bug when serving up JSP files:
1) it serves JSP files for downloading if you append a / to the .jsp URL
2) JSP pages in subdirectories do not work
3) JSP pages with parameters do not work

For installation, suppose that Domino is installed in:
d:\lotus\domino,d:\lotus\domino\data

Create the following directories:
d:\lotus\domino\data\domino\servlet
d:\classes
d:\jsptmp

Copy "gnujsp10.jar" and "servlet-2.0-plus.jar" from the GNUJSP distribution into d:\classes

In the server document make the following changes in "Internet Protocols->Domino Engine":
Java servlet support: Domino Servlet Manager
Servlet file extensions: *.jsp

Add this line to "notes.ini":
JavaUserClasses=d:\classes\servlet-2.0-plus.jar;d:\classes\gnujsp10.jar

In d:\lotus\domino\data make a file "servlets.properties" with the following content:
servlet.gnujsp.code=org.gjt.jsp.JspServlet
servlet.gnujsp.initArgs=scratchdir=d:\\jsptmp
servlet.gnujsp.extension=jsp

Restart the server and you are ready to do JSP!


From Philip Oldham ([email] phillip@adventmm.co.uk):

Firstly download and unzip the Tomcat JSP server from <http://jakarta.apache.org/>, and make sure you have the Java Development Kit installed, available from <http://sun.java.com> . Let's assume you've already got a working Tomcat installation and that the NT system variables JAVA_HOME, CALADERA_HOME (in version 4, which is the same as TOMCAT_HOME), TOMCAT_HOME and CLASSPATH are properly set. It is also a good idea to set these up in your AUTOEXEC.BAT to be available from startup. You can verify that this is the case by typing

C:\> full path to tomcat\bin\tomcat run - Version 3.2
C:\> full path to tomcat\bin\startup - Version 4.0

If everything is set up correctly Tomcat should start and it should be possible to connect to your server on port 8080 using a browser. Try something like

http://name_of_server:8080/

which, assuming Tomcat is still in its default state will produce the examples page. You need to make sure that you have a working Tomcat installation before continuing with these instructions. If you have problems with installing or configuring Tomcat, you'd better go here: <http://jakarta.apache.org/tomcat/>.
Once you've got a working Tomcat, download the tomcat_redirector.dll from <http://free.tagish.net/domino-tomcat/index.jsp> and copy the .dll to the Domino program directory (this is the directory, which may be called something like C:\Lotus\Domino, that contains a file called nlnotes.exe). Next we need to make some registry entries. The simplest way is to edit the supplied file tomcat_redirector.reg, which initially will look like this

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Dsapi Redirector\1.0]
"log_file"="C:\\tomcat\\logs\\domino.log"
"log_level"="debug"
"worker_file"="C:\\tomcat\\conf\\workers.properties"
"worker_mount_file"="C:\\tomcat\\conf\\uriworkermap.properties"
"tomcat_start"="C:\\tomcat\\bin\\tomcat.bat start"
"tomcat_stop"="C:\\tomcat\\bin\\tomcat.bat stop"

Edit this file to reflect the location where Tomcat has been installed, i.e. replace the instances of C:\\tomcat with the appropriate path remembering to retain the double backslashes. You may also need to edit the tomcat_start and tomcat_stop to the following in version 4.

"tomcat_start"="C:\\tomcat\\bin\\startup"
"tomcat_stop"="C:\\tomcat\\bin\\shutdown"

Once you've made the necessary changes save this file and double click on it to enter it into the registry.

Note that the files referred to by the worker_file and worker_mount_file keys need to exist and contain sane values. Default Tomcat installations will have these files. Note also that recent versions of Tomcat write a file called uriworkermap.properties-auto when they start up that can be renamed uriworkermap.properties to obtain default behaviour. It is a good idea to do this before configuring the Domino server.

It is also good practice to make sure that within TOMCAT_HOME\conf\workers.properties you've changed all instances of 'localhost' to '127.0.0.1'.

Automatically Starting Tomcat

The last two registry entries above provide commands that the redirector DLL will use to start and stop Tomcat when the Domino http server starts and stops respectively. If you don't require this behaviour these two lines can be omitted (or deleted if you've already placed them in the registry).

Configuring Domino

Finally we need to configure Domino to use the DSAPI extension DLL. For those who are unfamiliar with Domino server configuration most of a server's configurable behavior is dictated by a document called the "server document" in a database called the "Public Name and Address Book" or "NAB" for short (N.B. Lotus have renamed the NAB to "Domino Directory" from Domino 5 onwards). Each Domino server will have a NAB (called names.nsf) and each NAB will have a number of server documents including one for the current server. If you have not previously configured a Domino server you may need to refer to the supplied documentation, or you may need to pass this document to your tame Domino administrator.

Assuming you know your way around a Domino server document what we're going to do is actually quite simple. Open the server document for this server, place it in Edit mode, then locate the DSAPIsection and the 'DSAPI filter file names' field on the Internet Protocols tab, HTTP sub-tab. Add "tomcat_redirector.dll" to the DSAPI field, then save and close the document.

Enabling environment memory

Another thing which needs to be done to allow tomcat to run under the Domino server, is to enable the Domino server's initial environment memory to be at its fullest. This is done by finding the CONAGENT.EXE, usually located in C:\WINDOWS\SYSTEM (or similar on NT machines), and with the Domino server NOT RUNNING, right click on the icon and choose properties. Under the memory tab, locate Initial Environment, and increase it to 4096. Then click OK.
Restart Domino

In order to get these settings to take effect and make sure that you haven't disrupted anything else you should now restart the Domino server. If the server is running as a service and you have changed any relevant system variables (JAVA_HOME, TOMCAT_HOME, CLASSPATH) since the last time you restarted the computer you should do a complete restart now because updates to system variables are not seen by services until after a reboot. If all goes well you should see something like this on the server console when the web server starts up.

29/05/2001 18:54:13 JVM: Java Virtual Machine initialized.
29/05/2001 18:54:14 Attempting to start Tomcat: C:\tomcat\bin\tomcat.bat start
Including all jars in C:\Tomcat\lib in your CLASSPATH.

Using CLASSPATH: C:\Tomcat\classes;C:\Tomcat\lib\ant.jar;C:\Tomcat\lib\servlet.jar

Starting Tomcat in new window

29/05/2001 18:54:15 Apache Tomcat Interceptor (Jakarta/DSAPI/1.0) loaded
29/05/2001 18:54:16 HTTP Web Server started

At about the same time Tomcat should open in a new window (assuming you enabled the autostart option in the registry settings). You should now be able to visit a URL that is handled by Tomcat. Something like

http://name
of server/index.jsp
This is the ROOT_TO_TOMCAT\webapps\root\ directory.

may be available, depending on how Tomcat is configured.

Many thanks to Andy Armstrong. Any additional information can be obtained from <http://free.tagish.net/domino-tomcat/index.jsp>.

Applies to Notes Versions: 5
Last Modified: October 4, 2001