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:
-
Download and install Apache Tomcat 6 from the Apache web site following the standard installation instructions.
-
In the Tomcat home directory, add the following line to the
conf/server.xml
file:
<Listener className="org.mule.module.tomcat.MuleTomcatListener" />
-
Copy the contents of the Mule
lib
folder with all its subdirectories except/boot
to themule-libs/
directory under your Tomcat home directory (create one if necessary). You do not need to flatten the directories. -
Copy the
mule-module-tomcat-<version>.jar
file to themule-libs/mule/
directory under your Tomcat home directory (if it is not there already). -
Copy the following libraries from your Mule
lib/boot/
directory to your Tomcatmule-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
-
-
In the Tomcat
conf/catalina.properties
file, add the following tocommon.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.