Deploying Web Applications to Apache Tomcat

Deploying your J2EE web applications to the Apache Tomcat 4.1.12 server involves two main steps:

Note: Before you start a BC4J project to be deployed to Apache Tomcat, you must select a connection type and the corresponding SQL dialect, type maps or domains. For instructions, see Understanding Connections, SQL Dialect, Type Maps, and Domains.

Loading BC4J Runtime Libraries to Apache Tomcat

The steps in this section are a one time task which you perform when you deploy web applications created in JDeveloper to Apache Tomcat for the first time. For all subsequent deployments whenever you add a new J2EE WAR file, you only need to perform the steps in the next section and then restart Tomcat.

To load BC4J runtime libraries to Apache Tomcat:

You must first copy the various JDeveloper runtime libraries, which are located in different JDeveloper directories, to the following Apache Tomcat installation directory. In most cases, you would copy these files into <Tomcat_install>/lib. However, in general, WAR files are copied to the <Tomcat_install>/webapps directory.

  1. Copy the BC4J runtime libraries.
  2. Copy the UIX and JDeveloper runtime libraries. For the cabo.war file, copy this file to the <Tomcat_install>/webapps directory.
  3. Copy the JDBC database retrieval and character conversion libraries.
  4. Copy the interMedia Text libraries. interMedia Text is an Oracle9i feature for storing, retrieving, and manipulating audio, document, image, and video data in an Oracle database.
  5. Copy the runtime support libraries.
  6. Copy the XML support library.
  7. Copy the client data model support file.
  8. Copy the BC4J web application image and cascading style sheet support file, webapp.war, into the <Tomcat_install>/webapps directory.

Note: The correct directory location for these files in releases after Tomcat 4.1.12 may change. Check the JDeveloper Release Notes under "Deployment" for information about directory locations for later releases.

Creating a web archive (WAR) file for Deployment to Tomcat

  1. In JDeveloper, make sure that you've created a workspace and project.
  2. (Optional) If your web application is accessing business logic in the Oracle9i database, make sure that you've created a BC4J project.
  3. If not already done, create a web application such as a JSP or servlet based on the business logic.

    Note: JDeveloper automatically generates the web.xml deployment descriptor for the web application.

  4. Create a deployment profile for web applications (WAR).
  5. To edit the WAR deployment profile settings, select and right-click WAR_dep_profile_icon <webapp>.deploy and choose Settings from the context menu. The WAR Deployment Profile panel displays.
    1. General Page: enter a default location for the deployed WAR file. Oracle recommends that you specify the following location for your deployed web applications:

      <Tomcat_install>/webapps/<subdirectory>

    2. Enter the Enterprise Application Name. The default name is webapp but you can enter any other name.
    3. On Tomcat, the system administrator must assign a context path to your application in the conf/server.xml file:
       
              <DefaultContext crossContext="true"/> 

      This will allow the WAR file in the root of <tomcat-install>/webapps to detect the /cabo/ shared installables. See Tomcat system administration documentation for more information.

    4. Keep the default settings on the remaining pages.
    5. Click OK when you are done.
  6. Select and right-click WAR_dep_profile_icon <webapp>.deploy and choose Deploy to WAR file from the context menu.

    The WAR which contains the generated web application files are deployed directly to location you specified in step 5.a above: <Tomcat_install>/webapps/<subdirectory>. See the Deployment Log window for details.

    Note: However, if you skipped step 5 and did not specify a default location for the deployed WAR, you will need to copy the unpacked directory hierarchy into a subdirectory below <Tomcat_install>/webapps.

  7. Stop Tomcat.
  8. Restart Tomcat for all changes to take effect.
  9. When Tomcat is started, it will automatically expand the WAR.
  10. Execute the application in your browser by entering the enterprise name you specified in step 5.2 for the WAR. For example:

    http://<hostname>:8080/<webapp>/main.html

Notes:


Related topics

Developing Web Applications (J2EE Web Modules)
Deploying a Web Application to Other Application Servers
About J2EE Applications and How They Are Packaged and Deployed
Creating and Deploying a WAR to WebLogic
Creating and Deploying a J2EE Web Module Deployment Profile (WAR) to OC4J
About Business Components for Java (BC4J) Deployment
Deploying a BC4J Web Application to WebLogic