1

I'm trying to understand the model that Apache Tomcat adheres to, and the documentation apparently doesn't make sense to me.

As I understand it, Tomcat is a server for hosting a wide variety of services - so it's pretty generic. I've got this application that I'm trying to understand how to host, and its main method of deployment appears to be as a Tomcat-hosted web service - the application is called Camunda (its on github). After going through the docs for Camunda, my Tomcat directory becomes absolutely filled with Camunda-related jars, and config files, etc. The docs say to just plop everything right into the Tomcat lib folder, conf folders, etc.

Most of my experience with other "platform" / "service" style host applications has been that the application itself, in this case Tomcat, stays pretty untouched in its own directory. Through config files, etc, it knows how to host whatever it needs to host.

In the case of Tomcat, it seems that it's customary to basically "pollute" the Tomcat dir with a bunch of libs for the hosted content?

This is why I made the title "is Tomcat meant to be one install per application", because for all intents and purposes once you host something in Tomcat the directory becomes so coupled with that something that the Tomcat directory IS that something.

Is this normal? Just looking for some clarification in perhaps other terms that the docs put it, because the docs don't seem to be very clear to me.

Here is a link to the install process that I am following and referring to: https://docs.camunda.org/manual/latest/installation/full/tomcat/manual/

Ryan
  • 7,733
  • 10
  • 61
  • 106
  • 1
    A link would be helpful as there is more than one project of similar name. You are correct that, typically, multiple applications (here called "Servlets") are deployed to a single Tomcat instance, each as a .war file (basically a special kind of .jar file) that Tomcat will extract (unzip.) Were you following the guide for camunda/camunda-bpm-workbench "Install-Workbench-inside-an-Application-Server"? This hasn't been updated since 2015, but if it's really what you need .. they also have a stand-alone Application: https://github.com/camunda/camunda-bpm-workbench/wiki/Standalone-Application – CodeShane Feb 23 '19 at 07:58
  • 1
    In regards to "polluting" the Tomcat directory, this answer could be helpful: https://stackoverflow.com/a/10077070/10898724 – Dan_Maff Feb 23 '19 at 08:16
  • The only reason to put any JAR file into Tomcat's `lib` directory is to share it between applications or to overcome some security problem. If your app vendor's recommendation is to install all their JAR files there, they don't know what they are talking about. There should usually be no reason to install *anything* but their .war file. – user207421 Feb 23 '19 at 08:41
  • @CodeShane I edited my original post and added the link to the install guide that I am following: https://docs.camunda.org/manual/latest/installation/full/tomcat/manual/ – Ryan Feb 23 '19 at 13:51
  • Thank you, @Ryan - I was going to post a complete answer once we had a complete question, but am happy to see you've already found your answer. :) – CodeShane Mar 02 '19 at 07:38

1 Answers1

1

It's been a while since I've used Tomcat, but not only is it not one-install-per-application, it's not even one-install-per-virtual-host.

Tomcat is (amongst other things) a servlet container. The directory layout and such for servlets was standardized in the Java Servlet Specification v2.2. You can download the latest servlet spec here.

The docs say to just plop everything right into the Tomcat lib folder, conf folders, etc.

Hopefully they're talking about the ones in a .war file or similar, or shared libs in the shared locations. You can put shared libraries in a location where they can be reused across applications (or even virtual hosts), which was probably useful back when disk space was more expensive, but these days I assume most people put the libs for an app in the /WEB-INF/lib directory in the application's .war file.

This page talks about the "directory" layout of a .war file (which is basically a .jar with a particular structure).

It's true that typically .war files are expanded into subdirectories of the Tomcat installation directory, but as indicated in the answer that Dan_Maff linked to in a comment, you can modify the server.xml file to have it look elsewhere instead.

You can install a webapp called Manager that helps with installing, activating, deactivating, and managing web apps via .war files. (There's also a Host Manager for managing virtual hosts.)

All that said, you certainly could do one application per Tomcat install if you wanted. You'd need a reverse proxy in front of it (Apache, Nginx, etc.) so the same port (e.g., 80) could be used for the external URL of the various applications, and you'd need to assign each Tomcat install its own internal port for the reverse proxy to talk to.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875