How to Install and Configure NetWare EnterpriseWeb Server or Apache Web Server with Tomcat
Articles and Tips: article
Technical Director
GNE - Grebe Neumann Gliwa GmbH, Germany
u_neumann@gne.de
01 Nov 2001
Many of you have heard about Tomcat, but may not know how to install and configure Tomcat with NetWare Enterprise Web Server, Apache or both simultaneously. Tomcat is the reference implementation for Servlets 2.2 and Java Server Pages 1.1. This AppNote discusses the installation of Tomcat and tells how to integrate Tomcat with NetWare Enterprise Web Server and Apache Web Server for NetWare.
- Introduction
- Installing Tomcat
- Integrating Tomcat with NetWare Enterprise Web Server
- Installing Apache
- Integrating Tomcat with Apache
- Conclusion
Topics |
Tomcat, NetWare Enterprise Web Server, Apache |
Products |
NetWare Enterprise Web Server |
Audience |
network designers, administrators, integrators |
Level |
intermediate |
Prerequisite Skills |
familiarity with Web Servers |
Operating System |
NetWare 5.x, NetWare 6 |
Tools |
n/a |
Sample Code |
yes |
Introduction
Let's start with the goal of the Jakarta Project as stated on their Web site: "To provide commercial-quality server solutions based on the Java Platform that are developed in an open and cooperative fashion. Jakarta is the overall project for many subprojects. For example, Tomcat is the Servlet+JSP Engine which is a subproject of the Jakarta Project. Many people confuse Jakarta and Tomcat; the reality is that Jakarta is essentially just this Web site and Tomcat is a product on this Web site."
For information about each of the projects, see http://jakarta.apache.org.
Jakarta-Tomcat is a servlet/JSP engine published under the Apache license. In a more exact description, Tomcat itself is a combination of several products. It is a Web server and a servlet/JSP engine; it uses the build tool ant, which is another subproject of Jakarta.
Installing Tomcat
Do not run Tomcat on a server with BorderManager, because both applications use port 8080. If you do, be sure that the primary interface port 8080 is usable for Tomcat.
Download Tomcat from http://jakarta.apache.org/tomcat. You need the following files:
jakarta-tomcat-3.2.2.zip
jni_conn.nlm
mod_jk.nlm
nsapi_rd.nlm
Extract jakarta-tomcat-3.2.2.zip to sys:\jakarta-tomcat-3.2.2. Be sure that you have the folders sys:\jakarta-tomcat-3.2.2\lib and sys:\jakarta-tomcat-3.2.2\bin.
Add the following lines to your sys:\etc\java.cfg file:
TOMCAT_HOME=sys:\jakarta-tomcat-3.2.2 CLASSPATH=$CLASSPATH;$TOMCAT_HOME/lib/ant.jar CLASSPATH=$CLASSPATH;$TOMCAT_HOME/lib/jasper.jar CLASSPATH=$CLASSPATH;$TOMCAT_HOME/lib/jaxp.jar CLASSPATH=$CLASSPATH;$TOMCAT_HOME/lib/parser.jar CLASSPATH=$CLASSPATH;$TOMCAT_HOME/lib/servlet.jar CLASSPATH=$CLASSPATH;$TOMCAT_HOME/lib/webserver.jar
Create sys:\system\tomcat.ncf with the following line (all in one line):
Java -Dtomcat.home="sys:/jakarta-tomcat-3.2.2" org.apache.tomcat.startup.Tomcat
Restart JAVA (type "java -exit" and then "java" at the system console).
Type "tomcat" at the system console.
Test Tomcat with http://YourServerIP:8080
You can configure contexts with the URL: http://YourServerIP:8080/admin. If you want to access your contexts with full information, you must edit sys:\jakarta-tomcat\conf\server.xml, search for <Context path="/admin" and change the statement trusted="false" to trusted="true". Now you can view all contexts. If you need to log in, you should look up all predefined usernames and passwords in sys:\jakarta-tomcat\conf\tomcat-users.xml.Your server should have at least 256MB of RAM, or your servlets and JSP pages will be very slow.
Integrating Tomcat with NetWare Enterprise Web Server
During the first start of Tomcat, the automatic config file sys:\jakarta-tomcat- 3.2.2\conf\obj-auto.conf is generated. This file holds all information for the Netware Enterprise Web Server integration.
Edit sys:\jakarta-tomcat-3.2.2\conf\workers.properties and set the following values:
workers.tomcat_home=sys:\jakarta-tomcat-3.2.2 workers.java_home=sys:\java
For JVM 1.2.2 or JVM 1.3:
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps) classic$(ps)jvm.nlm
For JVM 1.1.7b:
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)java.nlm
Copy nsapi.nlm and jni_conn.nlm to sys:\system.
Edit sys:\novonyx\suitespot\https-SERVER\config\obj.conf and insert the following lines:
# Netscape Communications Corporation - obj.conf # You can edit this file, but comments and formatting changes # might be lost when the admin server makes changes. Init fn="load-types" mime-types="mime.types" Init fn="cache-init" MaxTotalCachedFileSize=2400 Init fn="load-modules" funcs="jk_init,jk_service" shlib="sys:/system/nsapi_rd.nlm" Init fn="jk_init" worker_file="sys:/jakarta- tomcat-3.2.2/conf/workers.properties" log_level="debug" log_file="sys:/jakarta-tomcat-3.2.2/logs/netscape_redirect.log" ... <Object name="default"> NameTrans fn="assign-name" from="/servlet/*" name="servlet" NameTrans fn="assign-name" from="/*.jsp" name="servlet" # Name Translation for examples context NameTrans fn="assign-name" from="/examples/servlet/*" name="servlet" NameTrans fn="assign-name" from="/examples/*.jsp" name="servlet" NameTrans fn="pfx2dir" from="/examples" dir="sys:/jakarta-tomcat-3.2.2/webapps/examples" # Name Translation for the admin context NameTrans fn="assign-name" from="/admin/servlet/*" name="servlet" NameTrans fn="assign-name" from="/admin/*.jsp" name="servlet" NameTrans fn="pfx2dir" from="/admin" dir="sys:/jakarta-tomcat-3.2.2/webapps/admin" # Name Translation for the test context NameTrans fn="assign-name" from="/test/servlet/*" name="servlet" NameTrans fn="assign-name" from="/test/*.jsp" name="servlet" NameTrans fn="pfx2dir" from="/test" dir="sys:/jakarta-tomcat-3.2.2/webapps/test" ... <Object name="servlet"> ObjectType fn="force-type" type="text/html" Service fn="jk_service" worker="ajp12" path="/*" </Object>
Place the tomcat redirector behind the Init fn="cache-init" line and the <Object name="servlet"> </Object" before the asp2lcgi Object.
Shuptdown Netware Enterprise Web Server and restart it (type nswebdn and nsweb at the system console).
Test NetWare Enterprise Web Server/Tomcat integration with the following servlet: http://YourServerIP/servlet/SnoopServlet
If all is correct, you'll get several Server and Client parameters.
To test the predefined contexts, type the URLs listed below. You'll be prompted for NDS username and password to access these contexts. If you don't want authentication, you must add a public directory designation to sys:/jakarta-tomcat-3.2.2/webapps/ with the Netware WebManager.
https://YourServerIP/test
https://YourServerIP/admin
https://YourServerIP/examples/jsp/dates/date.jsp
If you manually made changes to obj.conf to be accepted by the WebManager, do the following:
Start WebManager with https://YourServerIP:2200.
Click Enterprise Webserver.
Click Apply.
Click Load Configuration Files. (I know, clicking on "Load Configuration Files" sounds confusing, but it works.)
The examples are located in sys:\jakarta-tomcat-3.2.2\webapps\examples\. The default location for servlets is sys:\jakarta-tomcat-3.2.2\webapps\examples\ WEB-INF. For example, you can copy sys:\java\servlets\SimpleServlets to this location and it works with Tomcat.
If you want to start NetWare Enterprise Web Server and Tomcat within your AUTOEXEC.NCF, start NetWare Enterprise Web Server first and give it enough time to load and then start Tomcat. You can use the following lines to load NetWare Enterprise Web Server and Tomcat:
java nsweb ?echo off ?echo off ?tomcat
The question mark is a delay of about 10 seconds during startup. It is very important to load Java first; otherwise Tomcat doesn't start correctly if you boot the server.
Installing Apache
Download Apache Web server from http://httpd.apache.org/ dist/httpd/binaries/netware/Apache_1.3.20_Netware.zip.
Extract Apache_1.3.20_Netware.zip to sys:\apache. Be sure that you have the folders sys:\apache\modules, sys:\apache\conf, and so on.
If you want to use NetWare Enterprise Web Server and Apache simultaneously on the same server, select another port or add a secondary IP address to your server for Apache.
Edit sys:\apache\conf\httpd.conf and configure the following parameters:
ServerAdmin you@domain.com ServerName www.domain.com Port 80 Bind * or Bind YouServerIP
Type "search add sys:\apache" at the system console.
Start Apache by typing "apache" at the system console.
Test Apache with http://YourServer.
If you want to load Apache simultaneously with NetWare Enterprise Web Server during server startup, insert the following lines in your AUTOEXEC.NCF file:
add secondary ipaddress x.x.x.x search add apache apache
Integrating Tomcat with Apache
Install Tomcat as mentioned at the beginning of this article.
Copy mod_jk.nlm to sys:\apache\modules.
Edit sys:\jakarta-tomcat-3.2.2\conf\workers.properties and set the following values:
workers.tomcat_home=sys:\jakarta-tomcat-3.2.2 workers.java_home=sys:\java
For JVM 1.2.2 or JVM 1.3:
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)bin$(ps) classic$(ps)jvm.nlm
For JVM 1.1.7b:
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)bin$(ps)java.nlm
Edit sys:\apache\conf\httpd.conf and insert the following lines just before the other LoadModule statements:
LoadModule jk_module modules/mod_jk.nlm JkWorkersFile sys:/jakarta-tomcat-3.2.2/conf/workers.properties
Search for the line LogLevel warn and insert the following behind this line:
JkLogLevel error
Search for the line CustomLog and insert the following behind this line:
JkLogFile sys:/jakarta-tomcat-3.2.2/logs/mod_jk.log
Search for the line ServerSignature On and insert the following behind this line:
JkMount /*.jsp ajp12 JkMount /servlet/* ajp12
Unload and reload Apache.
Test Apache/Tomcat integration with the following servlet: http://Your- Server IP/servlet/SnoopServlet. If all is correct, you'll get several Server and Client parameters. Be sure that you use the IP address of the Apache Web server.
To enable the examples context of Tomcat, insert the following lines in your httpd.conf file (these lines must be added near by the JkMount statements mentioned before):
JkMount /examples/servlet/* ajp12 JkMount /examples/*.jsp ajp12
Search for the statement <IfModule mod_alias.c> and place the following lines behind this statement:
# The following line makes apache aware of the location of the /examples context Alias /examples"sys:/jakarta-tomcat-3.2.2/webapps/examples" <Directory "sys:/jakarta-tomcat-3.2.2/webapps/examples"> Options Indexes FollowSymLinks </Directory> # The following line prohibits users from directly accessing WEB-INF <Location "/examples/WEB-INF/"> AllowOverride None deny from all </Location> <Directory "sys:/jakarta-tomcat-3.2.2/webapps/examples/WEB-INF/"> AllowOverride None deny from all </Directory> # The following line prohibits users from directly accessing META-INF <Location "/examples/META-INF/"> AllowOverride None deny from all </Location> <Directory "sys:/jakarta-tomcat-3.2.2/webapps/examples/META-INF/"> AllowOverride None deny from all </Directory>
To enable the admin context of Tomcat, insert the following lines to your httpd.conf file (these lines must be added near by the JkMount statements mentioned before):
JkMount /admin/servlet/* ajp12 JkMount /admin/*.jsp ajp12
Search for the statement <IfModule mod_alias.c> and place the following lines behind this statement:
# The following line makes apache aware of the location of the /admin context Alias /admin "sys:/jakarta-tomcat-3.2.2/webapps/admin" <Directory "sys:/jakarta-tomcat-3.2.2/webapps/admin"> Options Indexes FollowSymLinks </Directory> # The following line prohibits users from directly accessing WEB-INF <Location "/admin/WEB-INF/"> AllowOverride None deny from all </Location> <Directory "sys:/jakarta-tomcat-3.2.2/webapps/admin/WEB-INF/"> AllowOverride None deny from all </Directory> # The following line prohibits users from directly accessing META-INF <Location "/admin/META-INF/"> AllowOverride None deny from all </Location> <Directory "sys:/jakarta-tomcat-3.2.2/webapps/admin/META-INF/"> AllowOverride None deny from all </Directory>
To enable the test context of Tomcat, insert the following lines to your httpd.conf file (these lines must be added near by the JkMount statements mentioned before):
JkMount /test/servlet/* ajp12 JkMount /test/*.jsp ajp12
Search for the statement <IfModule mod_alias.c> and place the following lines behind this statement:
# The following line makes apache aware of the location of the /test context Alias /test "sys:/jakarta-tomcat-3.2.2/webapps/test" <Directory "sys:/jakarta-tomcat-3.2.2/webapps/test"> Options Indexes FollowSymLinks </Directory> # The following line prohibits users from directly accessing WEB-INF <Location "/test/WEB-INF/"> AllowOverride None deny from all </Location> <Directory "sys:/jakarta-tomcat-3.2.2/webapps/test/WEB-INF/"> AllowOverride None deny from all </Directory> # The following line prohibits users from directly accessing META-INF <Location "/test/META-INF/"> AllowOverride None deny from all </Location> <Directory "sys:/jakarta-tomcat-3.2.2/webapps/test/META-INF/"> AllowOverride None deny from all </Directory>
Unload and reload Apache
Test Apache/Tomcat integration with the following links:
https://YourApacheServerIP/test
https://YourApacheServerIP/admin
https://YourApacheServerIP/examples/jsp/dates/date.jsp
You can use Tomcat with NetWare Enterprise Web Server and Apache simultaneously on the same server, if you add a secondary IP address for Apache.
If you use the admin context, username and password is "tomcat".
Conclusion
I hope this AppNote helps you get NetWare Enterprise Web Server, Apache, and Tomcat to work as expected.
The process described in this "How-To" AppNote is a collection of information from FAQ, newsgroups, documentation, and discussions. Much more information is available about these products, but I can't describe every aspect in this AppNote. If you need more information about Apache and the Jakarta project, visit the following Web sites:
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.