Kbase 21877: Setting Up AIA with Tomcat 3.3a on Apache (mod_jk plug-in)
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  4/16/2002 |
|
SUMMARY:
This Solution provides directions for setting up AIA using Tomcat 3.3a with the Apache Web server. NOTE: Progress Software does not offer technical support for Tomcat or Apache. These are only some guidelines for setting up this configuration. Further setup information can be obtained from:
http://httpd.apache.org
http://jakarta.apache.org/
This document is divided into the following 3 sections.
A) Setting up Tomcat
B) Mod_jk, setting up Tomcat to work with Apache
C) Turning off the Tomcat web server
********************************************************************
A) Setting up Tomcat
The Tomcat Java Servlet Engine (JSE) includes its own small Web server. This Web server should initially be used to test the Tomcat to AIA setup, prior to trying to use the Apache Web server. Apache does not supply it as a production Web server. It is not designed for that kind of use. It is designed for exampling and testing of JSE. The Tomcat Web server uses port 8080 by default, when Tomcat is started.
These are the steps to set it up:
NOTE: Assume that Tomcat is installed in TOMCAT_HOME directory
and the Progress AppServer component(s) are installed in
PROGRESS_HOME.
1) Create a new file "apps-aia.xml" in the TOMCAT_HOME/conf
directory; this defines a "context" for "aia" which will be
used in a URL to access AIA.
This is an example of this file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<webapps>
<Context path="/aia" docBase="webapps/aia" debug="0"
reloadable="true"></Context>
</webapps>
2) Create three new directories in the TOMCAT_HOME/webapps
directory:
webapps/aia (new dir)
webapps/aia/WEB-INF (new dir)
webapps/aia/WEB-INF/lib (new dir)
3) Create a new file named "web.xml" in the
TOMCAT_HOME/webapps/aia/WEB-INF directory. Here's an example of
this file -- substitute the correct value PROGRESS_HOME:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
Aia
</servlet-name>
<servlet-class>
com.progress.aia.Aia
</servlet-class>
<init-param>
<param-name>InstallDir</param-name>
<param-value>PROGRESS_HOME</param-value>
</init-param>
<init-param>
<param-name>instanceName</param-name>
<param-value>Aia1</param-value>
</init-param>
<init-param>
<param-name>propertyFileName</param-name>
<param-value>
PROGRESS_HOME/properties/ubroker.properties
</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>
Aia
</servlet-name>
<url-pattern>
/Aia
</url-pattern>
</servlet-mapping>
</web-app>
4) Copy PROGRESS_HOME/java/aia.zip into the
TOMCAT_HOME/webapps/aia/WEB-INF/lib directory, then rename the
new copy of "aia.zip" to "aia.jar". NOTE: earlier versions of
Tomcat allowed you to modify CLASSPATH in the Tomcat startup
scripts to include aia.zip (or progress.zip) and not have to
un-zip the file. This will not work in Tomcat 3.3a.
5) You will need to make some modifications to the
TOMCAT_HOME/bin/tomcat.sh (tomcat.bat for Windows) file. Tomcat
requires a minimum Java 2 run time environment. The JRE
provided with Progress 9.1C is recommended for this.
UNIX - tomcat.sh
TOMCAT_HOME=where_you_installed _tomcat; export TOMCAT_HOME
JAVA_HOME=$DLC/jre/; export JAVA_HOME
# The two above variables are general Tomcat variables, not
# specific to Progress. Tomcat requires a Java 2 JDK (or
# JRE), the JRE that ships with Progress on some UNIX
# platforms is suitable ($DLC/java).
# LD_LIBRARY_PATH is correct for both Solaris and Linux.
# use LIBPATH for AIX.
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DLC/lib;
export LD_LIBRARY_PATH
WRKDIR=specified_at_progress_install; export WRKDIR
# The three variables above are required by AIA; use the
# appropriate library path value for your system, usually
# LD_LIBRARY_PATH or LIBPATH.
Windows - tomcat.bat
set TOMCAT_HOME=C:\jakarta-tomcat3.3a
set JAVA_HOME=C:\Program Files\Progress\jre
6) Modifications to PROGRESS_HOME/properties/ubroker.properties.
To be able to "ping" AIA in step 9, in the [AIA] section,
change "allowAiaCmds=0" to "allowAiaCmds=1". This is set to
zero initially for security purposes.
If you did NOT install either the Secure AppServer or Secure
AIA components of Progress, continue with the next step.
If you did install either of these components, the default AIA
instance that is defined will expect to use a secure web server
and will redirect an HTTP request to HTTPS. If you do not want
this behavior, in the [AIA] section
change httpsEnabled=1 to httpsEnabled=0".
7) Start tomcat, run TOMCAT_HOME/bin/startup.sh (Unix), or
TOMCAT_HOME/bin/startup.bat (Windows).
8) From a local browser, try this URL:
http://localhost:8080
This brings up the top level Tomcat page. Choose the "Servlet
Examples" page and try executing some of the programs. Then
try:
http://localhost:8080/aia/Aia
You should get an "Aia1 OK" page.
Also try:
http://localhost:8080/aia/Aia?GetServletStatus
You should get a "Summary of Connection Status" page with
details about how Aia1 is configured in ubroker.properties.
You should not go further with Apache to Tomcat configuration
unless you are successful to this point!
9) At this point you can test Tomcat > AIA > Progress AppServer.
Try running a Progress (4GL) client connect through Tomcat/AIA
and to the Progress AppServer.
*********************************************************************
B) Mod_jk setting up Tomcat to work with Apache
Configuration of Tomcat to AIA was done prior to this, using the Tomcat Web server (port 8080). Now Apache gets added to the picture.
The mod_jk.so library is a dynamically loaded module that Apache uses to recognize JSP, Servlet, or XML requests that need to be handled by Tomcat. The communication between Apache and Tomcat is coordinated by mod_jk. Information about mod_jk can be found at :
http://jakarta.apache.org/tomcat/tomcat-3.2-doc/mod_jk-howto.html#s2
You need to get mod_jk from the above web site. On Windows you should be able to get away with downloading the mod_jk.dll. On some flavors of UNIX you may have to download the source files and build mod_jk. Instructions can be found on the above web site.
Once you have the mod_jk file, place it in the Apache's modules directory. Then:
1) Add the following line to the end of the httpd.conf file:
Include C:/jakarta-tomcat-3.3a/conf/auto/mod_jk.conf
2) Now you need to create the mod_jk.conf library file. To get this
file created you must modify the "<ApacheConfig" tag in the
TOMCAT_HOME/conf/server.xml file. Change "noRoot="true"" to
"noRoot="false"".
3) At the command line run:
startup.bat jkconf
- or -
startup.sh jkconf (on UNIX)
This will create the mod_jk.conf file and place it in the proper
folder.
4) After completion of these steps make sure the Apache Web Server
is shut down. Then start Tomcat, and then Apache. Also if any
changes are made to Tomcat you must stop Tomcat and Apache.
Tomcat must always be restarted first.
5) Time to test again.
http://localhost/aia/Aia (assuming the Apache Web server is
using port 80)
At this point, all requests sent to the Web server will get forwarded to Tomcat. The main idea in the Apache/Tomcat configuration is to make sure that the dynamic Java generated content is served by Tomcat, while the static content is still served by Apache. You can do that by commenting out a couple of lines in the mod_jk.conf file. Go to TOMCAT_HOME\conf\auto\mod_jk.conf and comment out the following:
#JkMount / ajp13
#JkMount /* ajp13
********************************************************************
C) Turning off the Tomcat Web server.
If you have followed all these steps you now have a Tomcat Web server on port 8080 and an Apache Web server running on port 80 (unless you specified a different port in the httpd.conf file). You can turn
off the Tomcat Web server by modifying the Tomcat server.xml file. All you need to do is to comment out the following in the tomcat/conf/server.xml file:
In the connectors sections ...
<!-- <Http10Connector port="8080"
secure="false"
maxThreads="100"
maxSpareThreads="50"
minSpareThreads="10" /> -->
Now stop and restart Tomcat and Apache. Tomcat must always be started first.
Reference to Written Documentation:
Progress Knowledge Base Solutions:
21923, "Error 9407 Running Application Through AIA With Tomcat 3.3"
21924, "Setting Up AIA with Tomcat 3.3a X Apache (mod_jserv plug-in)"