Deploying Mule as a Service to Tomcat
|MuleSoft recommends against deployments to Mule 3.8. Standard Support for this version ended on November 16, 2018, and Mule 3.8 will reach its End of Life on November 16, 2021, when Extended Support ends.|
This page describes two activities that let you deploy your Mule applications on a Tomcat Web server:
Install Mule as a service on an Apache Tomcat server
Set up your Mule applications for hot deployment
For more information on hot deploying Mule applications, see Application Server Based Hot Deployment.
The following instructions have been verified for use with Mule 3.7.3 and newer:
Download and install Apache Tomcat, following Apache’s installation instructions.
In the Tomcat home directory on your system, add the following line to the
<Listener className="org.mule.module.tomcat.MuleTomcatListener" />
mule-libssubdirectory under the Tomcat home directory.
Copy the contents of the Mule
libfolder with all its subdirectories – except
mule-libs/subdirectory of your Tomcat home directory. Do not flatten the directory structure.
mule-module-tomcat-<version>.jarfile to the
mule-libs/mule/directory in your Tomcat home directory.
Copy the following libraries from your Mule
lib/boot/directory to your Tomcat `mule-libs/opt/`directory:
In the Tomcat
conf/catalina.propertiesfile, add the following to
common.loader(preceded by a comma to separate it from existing values):
Ensure you have only one listener in your web.xml file:
<listener> <listener-class> org.mule.module.tomcat.MuleTomcatListener </listener-class> </listener>
Package your Mule application’s configuration files and custom Java classes in a
.warfile (see Application Server Based Hot Deployment).
In the Maven project, all Mule provided dependencies, that is, any library provided in the
mule-libsdirectory, must have a
<scope>provided</scope>definition to prevent classloading conflicts between duplicated libraries.
Copy your application’s
.warfile, then paste it in the Tomcat
Tomcat hot deploys the application.
If you need to make a change to the configuration or Java file in the Mule application, modify the file in the expanded directory under the Tomcat
/webapps directory, then touch the
web.xml file (for example, simply add and delete a space in the file and then save it). These actions trigger Tomcat to redeploy the application.
Alternatively, you can modify the application’s source files, repackage them as a
.war file, then drop the new
.war file into the
/webapps directory to trigger Tomcat to redeploy the application.
Learn about deploying Mule applications in the cloud with CloudHub.