On this blog post, We will cover the installation of Tomcat 9 on
Apache tomcat server basics
Tomcat is an application server which supports for running java,j2ee based applications. Tomcat is an open source application server built on a java framework. It is used for web application deployment on this server. Tomcat 9 supports Servlet4 and Jsp 2.3. Tomcat runs applications using HTTP protocol over TCP/IP protocol. The default port for tomcat installation is 80.
Tomcat provides different services like any other application servers such as JBoss, WebSphere
Tomcat Latest version 9.0.x supports following Specifications
- Servlet 4.0
- JSP 2.0
- Websocket 1.1
- JDK 1.8 or more
- OpenSSL Support
- java installation required - For tomcat 9.0.x Version, JDK 8 or more is required.
Setup Apache Tomcat 9.0 in windows:-
Following are the sequence of steps to setup and install tomcat in windows. Latest Tomcat Version is 9.0.12
Install JDK for tomcat
For Tomcat, JDK 8 or more is required,
Please make sure install JDK 1.8 version and configure the following environment variable
JAVA\_HOME=D:\\jdk path PATH=%PATH%;.;%JAVA\_HOME%\bin;
Download tomcat 9.0.x
Before downloading tomcat 9.0 to your machine, we need to find out 32 bit or 64-bit machine you are going to install, check here to find out 32 bit or 64 bit for your machine.
Latest tomcat in apache tomcat website.
First, Download Tomcat from apache site.
Yo can download from Tomcat 9.0 server from windows.apache-tomcat-9.0.12-windows-x86.zip file is downloaded to your machine, extract or unzip using WinRAR or zip tools to your drive(g:\)
let us say I have extracted to G drive like G:\apache-tomcat-9.0.12
tomcat environment variable settings
Configure Environment variables like CATALINA_HOME in the path variable.
Make the following environment settings for your tomcat.
To start Tomcat = run CATALINA_HOME\bin\startup.bat
To stop Tomcat run CATALINA_HOME\bin\shutdown.bat
Starting tomcat server
starts the tomcat server using
startup.bat. this opens the console starts the tomcat server .
Stopping tomcat server
Stopping or shutdown the tomcat server using
shutdown.bat. this opens the console stops the tomcat server.
finally, you have completed the tomcat setup in windows and got some basic idea on tomcat server.
tomcat server folder structure explanation
Here is folder structure as follows
bin folder: bin folder contains scripts for setting classpaths, start and shutdown and running scripts. scripts with .bat extensions are for windows server and .sh for Linux box.
setclasspath.batis used to configure any classpath related settings like JAVA_HOME etc.
startup.batis to start the tomcat as non window service mode.We can still install tomcat as windows service, However non-window server mode have more performance for tomcat startup.
tomcat9.exe is to start the tomcat as window service meaning if we install tomcat as windows service
shutdown.bat is to stop or shutdown the tomcat server.
catalina.bat is to set the tomcat environment related settings like JVM options, heap size settings and garbage collector settings
conf folder: configuration related files in tomcat like port number and log level changes etc..
server.xml contains settings for tomcat container like listening port number and resource configuration like JDBC data source, security settings.
tomcat-users.xml contains authentication and authorization details for tomcat administration console tool
Lib folder contains all the jars required to run for tomcat. This contains bootstrap class loader for tomcat server.
Jars in this folder are loaded into the container when tomcat application is started. These jars are available to all the applications deployed to tomcat container.
We can override the jars within the application.
always avoid duplicate with a different version of jars in lib folder with your application folder. otherwise, you will be in trouble with a lot of NoClassDefFounder issues.
logs folder:contains all the tomcat server related logs like standard out logs, access logs, and Catalina logs.
if we have any issues in tomcat, This folder is first check to look for the detailed information about the error.
temp and work folder: contain the
workfolder for your tomcat. It will acts cache for your application.
webapps folder: This is main folder where all your applications are deployed to. if you wan to deploy your application, copy your web application war file to this location.
That’s about the folder structure.
Is tomcat Application Server or Web server?
Yes. Tomcat is an application server which provides the following services
- Object Management like automatic object creation, modifying, and garbage collection
- JDBC Connection pool mechanism
- Maintaining multiple nodes in the cluster setup
- 99.99 start up time for running applications
- Configuring the different J2EE services like mbeans, enterprise objects like message beans within administrative tools
- Integration with different security frameworks like CUP with LDAP, and database realms
The advantages of the above services are that the developer need not write this and can concentrate on his business logic.
Web server is a server which serves the plain request and gives the response. apache web server need not be talking to the database
But in a production scenario, Apache httpd server acts front controller which delegates the request to the application server. The application server talks to the database and do the business logic and send the response to the web server, finally web server sends the response to a client.
How to know which tomcat version is running on machine
With command line, you can go to bin folder of your tomcat directory.
Run this command if you are in windows,
In Linux or Unix bash command mode
To Sump Up, You learned following things from this tutorial
- Apache tomcat server installation on windows
- Start an stop server
- How to find the version of tomcat server running
- Tomcat folder structure