<Listener className="org.mule.module.tomcat.MuleTomcatListener" />
Deploying Mule as a Service to Tomcat
| Mule Runtime Engine versions 3.5, 3.6, and 3.7 reached End of Life on or before January 25, 2020. For more information, contact your Customer Success Manager to determine how you can migrate to the latest Mule version. | 
This page describes two activities that will enable you to 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.
These instructions have been verified in Mule 3.7.3
Installing Mule on Tomcat
- 
Download and install Apache Tomcat, following Apache’s installation instructions.
 - 
In the Tomcat home directory on your system, add the following line to the
conf/server.xmlfile: - 
Create a
mule-libssubdirectory under the Tomcat home directory. - 
Copy the contents of the Mule
libfolder with all its subdirectories – except/bootto themule-libs/subdirectory of your Tomcat home directory. Do not flatten the directory structure. - 
Copy the
mule-module-tomcat-<version>.jarfile to themule-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:- 
commons-cli-1.2.jar - 
jcl-over-slf4j-1.7.7.jar - 
log4j-jcl-2.1.jar - 
slf4j-api-1.7.7.jar - 
disruptor-3.3.0.jar - 
wrapper-3.5.26.jar - 
log4j-slf4j-impl-2.1.jar - 
log4j-api-2.1.jar - 
log4j-core-2.1.jar 
 - 
 - 
In the Tomcat
conf/catalina.propertiesfile, add the following tocommon.loader(preceded by a comma to separate it from existing values):${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/mule-libs/user/*.jar,${catalina.home}/mule-libs/mule/*.jar,${catalina.home}/mule-libs/opt/*.jar,${catalina.home}/mule-libs/endorsed/*.jarEnsure you have only one listener in your
web.xmlfile:<listener> <listener-class> org.mule.module.tomcat.MuleTomcatListener </listener-class> </listener> 
Deploying Mule Applications in Tomcat
- 
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 -ie any library provided in the mule-libs directory- 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/webappsdirectory. - 
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.
See Also
- 
Learn about deploying Mule applications in the cloud with CloudHub.
 



