JKL Toy Company configures an in-process servlet with ASF Tomcat on HTTP Server (powered by Apache)

 

In the IBM HTTP Server for i5/OS, you can configure ASF Tomcat to use an in-process servlet.

Information for this topic supports the latest PTF levels for HTTP Server for i5/OS . IBM recommends that you install the latest PTFs to upgrade to the latest level of the HTTP Server for i5/OS. Some of the topics documented here are not available prior to this update. See IBM Service for more information.

 

Scenario

The JKL Toy Company (a fictitious company) wants to take an existing Java™ servlet named jklservlet.class and enable it to run, in-process, using the ASF Tomcat servlet engine with the HTTP Server (powered by Apache). The Servlet and JSP Enablement wizard will be used to modify the existing HTTP Server (powered by Apache), JKLTEST.

 

Prerequisites

 

Start the IBM Web Administration for i5/OS interface

Enter your Webmaster user profile username and password when prompted.

  1. Start a Web browser.

  2. Enter http://[iSeries_hostname]:2001 in the location or URL field .

    Example: http://jkl_server:2001

    If you have changed your port number for the Web Administration for i5/OS interface, replace port 2001 with your port number.

  3. Click IBM® HTTP Server for iSeries.

If the Web Administration for i5/OS interface does not start, see Installing and testing the HTTP Server.

 

Set up ASF Tomcat for your HTTP Server (powered by Apache)

  1. Click the Manage tab.

  2. Click the HTTP Servers subtab.

  3. Select your HTTP Server (powered by Apache) from the Server list.

    Example: JKLTEST

  4. Select Global configuration from the Server area list.

  5. Expand HTTP Tasks and Wizards.

  6. Click Servlet and JSP Enablement.

  7. Click Next.

    If you have used the Servlet and JSP Enablement wizard prior to this scenario, the wizard will reset all values to the wizard default. Click Next to continue.

  8. Select I want to use a servlet or Java Server Page (JSP), and I either already have them or will provide them later.

  9. Click Next.

  10. Select I want to use a servlet. I either already have a class or jar file containing the servlet or will provide it later.

  11. Enter the name of your servlet in Servlet class name field.

    Example: jklservlet

  12. Click Next.

  13. Click Finish.

 

Place your servlet file in the Web applications directory

Using a file transfer method such as iSeries™ Navigator, Netserver mapped drives, or FTP, transfer your servlet class files to your HTTP Server (powered by Apache) /www/[server_name]/webapps/app1/WEB-INF/classes/ directory. Place JAR files in the /www/server_name]/webapps/app1/WEB-INF/lib/ directory.

Example: /www/jkltest/webapps/app1/WEB-INF/classes/

Example: /www/jkltest/webapss/app1/WEB-INF/lib/

If you transfer the servlet source files only, you will need to compile them in the /classes directory. If transferring files over using a different user profile, ensure the files have the appropriate authorities after the transfer.

 

Restart your HTTP Server (powered by Apache)

Select one of the following methods below:

Manage one server

  1. Click the Manage tab.

  2. Click the HTTP Servers subtab.

  3. Select your HTTP Server from the Server list.

  4. Click the Stop icon if the server is running.

  5. Click the Start icon.

Manage all servers

  1. Click the Manage tab.

  2. Click the HTTP Servers subtab.

  3. Select All Servers from the Server list.

  4. Click the All HTTP Servers tab.

  5. Select your HTTP Server name in the table.

    Example: JKLTEST

  6. Click Stop if the server is running.

  7. Click Start.

If your HTTP Server (powered by Apache) does not start, see Troubleshooting.

 

Test your HTTP Server (powered by Apache)

  1. Start a new Web browser.

  2. Enter http://[iSeries_hostname]:[port]/app1/[servlet_name] in the location or URL field.

    Example: http://jkl_server:1975/app1/jklservlet

    Servlet names must be in lowercase.

Your new servlet is displayed.

 

View your HTTP Server (powered by Apache) configuration

Your configuration will look similar if you used the given example in this and previous examples.

  1. Click the Manage tab.

  2. Click the HTTP Servers subtab.

  3. Select your HTTP Server (powered by Apache) from the Server list.

    Example: JKLTEST

  4. Expand Tools.

  5. Click Display Configuration File.
LoadModule jk_module /QSYS.LIB/QHTTPSVR.LIB/QZTCJK.SRVPGM Listen *:1975
DocumentRoot /www/jkltest/htdocs ServerRoot /www/jkltest Options -ExecCGI -FollowSymLinks -SymLinksIfOwnerMatch -Includes -IncludesNoExec -Indexes -MultiViews HotBackup Off LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%{Cookie}n \"%r\" %t" cookie LogFormat "%{User-agent}i" agent LogFormat "%{Referer}i -> %U" referer LogFormat "%h %l %u %t \"%r\" %>s %b" common CustomLog logs/access_log combined SetEnvIf "User-Agent" "Mozilla/2" nokeepalive SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0
JkWorkersFile /www/jkltest/conf/workers.properties JkLogFile /www/jkltest/logs/jk.log JkLogLevel Error JkMount /app1/* inprocess JkMount /servlet/* inprocess <Directory />
	Order Deny,Allow 	Deny From all </Directory>
<Directory /www/jkltest/htdocs>
	Order Allow,Deny 	Allow From all </Directory>

 

Parent topic:

Scenarios for HTTP Server