Contact Us 1-800-596-4880

Deploying Mule as a Service to Tomcat

This page describes how to install Mule as a service in Apache Tomcat and set up your Mule applications for hot deployment. For more information on hot deploying Mule applications, see Application Server Based Hot Deployment.

Installing Mule in Tomcat

To install Mule in Tomcat so that you can hot deploy your Mule applications, you take the following steps:

  1. Download and install Apache Tomcat 6 from the Apache web site following the standard installation instructions.

  2. In the Tomcat home directory, add the following line to the conf/server.xml file:
    <Listener className="org.mule.module.tomcat.MuleTomcatListener" />

  3. Copy the contents of the Mule lib folder with all its subdirectories except /boot to the mule-libs/ directory under your Tomcat home directory (create one if necessary). You do not need to flatten the directories.

  4. Copy the mule-module-tomcat-<version>.jar file to the mule-libs/mule/ directory under your Tomcat home directory (if it is not there already).

  5. Copy the following libraries from your Mule lib/boot/ directory to your Tomcat mule-libs/opt/ directory:

    • jcl104-over-slf4j-1.5.0.jar

    • log4j-1.2.14.jar

    • slf4j-api-1.5.0.jar

    • slf4j-log4j12-1.5.0.jar

  6. In the Tomcat conf/catalina.properties file, add the following to common.loader (precede with a comma to separate it from existing values):
    ${catalina.home}/mule-libs/user/.jar,${catalina.home}/mule-libs/mule/.jar,${catalina.home}/mule-libs/opt/*.jar

Copying the Mule Application Files

After you package your configuration files and custom Java classes in a WAR file (see Application Server Based Hot Deployment), copy your Mule applications WAR files to the Tomcat /webapps directory.

Hot Deploying Mule Applications

After you have copied the WAR file for your Mule application to the Tomcat /webapps directory, Tomcat deploys it. If you need to make a change to a configuration or Java file in the webapp, simply modify the file in the exploded directory under the Tomcat /webapps directory, and then touch the web.xml file (or you can simply add and delete a space in the file and then save it) to trigger Tomcat to redeploy the application. Alternatively, you could modify the source files, repackage them as a WAR, and drop the new WAR into the /webapps directory to trigger Tomcat to redeploy the application.