Tomcat is an application server which supports for running java,j2ee based applications. Tomcat provides different services like any other application servers such as JBoss, WebSphere
Is tomcat Application Server or Web server?Yes. Tomcat is an application server which provides the following services
1.Object Management like automatic object creation, modifying, and garbage collection
2.JDBC Connection pool mechanism
3. Maintaining multiple nodes in the cluster setup
4.99.99 startup time for running applications
5.Configuring the different j2ee services like mbeans, enterprise objects like message beans within administrative tools
6.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.
Setup Apache Tomcat 9.0 in windows:-following are the sequence of steps to setup tomcat in windows. Latest Tomcat Version is 9.0.12
Install JDK for tomcatFor 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%;
Download tomcat 9.0.xBefore 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.
First try to download the download Tomcat 7.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(d:\)
let us say I have extracted to G drive like G:\apache-tomcat-9.0.12
tomcat server folder structureComing to the folder structure as follows
setclasspath.bat is used to configure any classpath related settings like JAVA_HOME etc.
startup.bat is to start the tomcat as nonservice mode meaning if we don't install tomcat as windows service, this will increase performance for tomcat
tomcat7.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 bootstrap class loader for tomcat meaning, 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 chock to look for the detailed information about the error.
temp and work folder:- contain the temporary tomcat work folder 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 webapplication war file to this location.
That's about the folder structure.
tomcat environment settingsmake the following environment settings for your tomcat.
Starting tomcat serverstarts the tomcat server using startup.bat. this opens the console starts the tomcat server
Stopping tomcat serverstopping 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.
Please feel free to comment if you have any questions.