Chapter 31. Integrating Tomcat and JOnAS (for JOnAS version < JOnAS 2.6)

This guide describes how to integrate JOnAS with Tomcat from Apache (http://jakarta.apache.org/tomcat/index.html). JOnAS will be used to run your beans inside EJB containers while Tomcat will be used to run your servlets or JSPs. Inside these servlets or JSPs, you can remotely access beans inside the JOnAS EJBServer.

For cases where you need security, Tomcat will be used also for user authentication. Refer to Chapter 33 Example for Using Security in JOnAS with Tomcat for more information on how to use security with JOnAS and Tomcat.

The following steps describe how to configure JOnAS and Tomcat to make them work together.

  1. Section 31.1 Installing Tomcat

  2. Section 31.2 Configuring Tomcat for JOnAS

  3. Section 31.3 Structuring your Web Application

  4. Section 31.4 Writing a servlet accessing a bean

  5. Section 31.5 Writing a JSP accessing a bean

  6. Section 31.6 Compiling your Web Application

  7. Section 31.7 Running your Web Application

  8. Section 31.8 Troubleshooting

The two families of Tomcat products—Tomcat 3.3.x and Tomcat 4.0.x—differ on several points, but we describe how to work with each Tomcat family.

31.1. Installing Tomcat

  1. Download Tomcat from the Apache site (http://jakarta.apache.org/site/binindex.html).

  2. Install Tomcat by unzipping the download file and putting it in a specific directory.

    • For Tomcat 3.3.x: This directory will be referred to as $TOMCAT_HOME. Set the TOMCAT_HOME variable in your environment and export it.

    • For Tomcat 4.0.x: This directory will be referred to as $CATALINA_HOME. If you want to share a single copy of Tomcat 4 among multiple users on the same server, you must configure a CATALINA_BASE environment variable (in addition to CATALINA_HOME) that points to a directory that is unique to your instance. Set both variables in your environment and export them.

  3. On Windows, set the JAVA_HOME variable in your environment to your JDK installation directory.