35+ Top Apache Tomcat Interview Questions and Answers

Most frequently asked Apache Tomcat Interview Questions and answers:

We will learn the complete functionality of Apache Tomcat in this article.

You will get to know more about What exactly is Apache Tomcat, what is the use of Apache Tomcat, Default ports of tomcat, Web container of it, what are the types of batch and script file to start and stop tomcat. 

Also covered questions on how to install tomcat in eclipse, its configurations files, versions and types of connectors, Catalina, WAR file and deployment process, Tomcat Valve, Different log files, how to secure the web server, function of virtual hosting, important files locations etc in simple terms.

apache tomcat interview questions

It is advisable to have a good knowledge on the important concepts as the interviewer will try to loop you around those questions as these cover the major functionalities related to Apache Tomcat and they are the ones which are used widely and rigorously.

You should try to understand what Apache Tomcat is and why it came into the picture.

If you have the hands-on knowledge, then it will be an added advantage as you will be able to explain it with real-time examples which in turn is the key point for clearing an interview.

Most Popular Apache Tomcat Interview Questions

Given below is the list of Most Frequently asked Apache Tomcat Interview Questions which would help you to clear any Apache Tomcat Interview successfully.

Overview of which Apache Tomcat Questions are covered here:

  • What is Tomcat and why did it come into the picture?
  • How to install tomcat in eclipse?
  • Types of servers.
  • About WAR and Web Container.
  • Types of Batch and Script File used.
  • What is Virtual Hosting?
  • Securing Web Server.
  • Start and Stop Apache Tomcat Server by commands
  • Different status codes 403 and 404
  • MAC
  • Apache Tomcat Versions
  • Types of Web Servers
  • Types of Logs in Apache Tomcat
  • Listen Functionality
  • Tomcat valve
  • Catalina and configuration files
  • Benefits of running Tomcat as Web Service
  • Connectors and its use.
  • Restriction of file uploads

Let's start with detailed answers.

Q #1) What is Apache Tomcat?

Answer: Apache Tomcat is basically a Web Server and Servlet system which is open source (i.e. freely available on the internet) and is created by Apache Software Foundation.

Apache Tomcat is the server which is mostly used by Java Developers.

The server is nothing but a computer program that provides service to other computers.

There are basically two types of server:

  1. Application Server
  2. Web Server

Apache Tomcat offers HTTP protocol, which means the user can connect with the server from anywhere by the URL provided and can access the Java Application.

Apache Tomcat is very easy and simple to install and is compatible with any Operating System.

apache tomcat diagram

Q #2) Why do we require Apache Tomcat?

Answer: Apache Tomcat is required to run Java Web Applications on the host and server-based system. It also helps to run JSP and Servlets.

Q #3) What is the default port for Apache Tomcat?

Answer: The default port of Apache Tomcat is port 8080.

After installing Tomcat on your system, click here to validate if Tomcat is running.

port no

Q #4) What is the name of inbuilt Web Container in Tomcat?

Answer: The name of the inbuilt Web Container in Tomcat is Catalina which is present in the bin directory.

Catalina is used for loading all the requests related to HTTP and can instantiate the objects of GET () and POST () methods.

Q #5) What are the types of batch file with the help of which we can Start and Stop Apache Tomcat Server?

Answer: There are basically two types of batch file with which we can Start and Stop Apache Tomcat Server.

They are as follows:

  1. Startup.bat
  2. Shutdown.bat

Q #6) How can we configure Apache Tomcat in Java Eclipse IDE or explain the setup of Apache Tomcat Server?

Answer: It is really very easy and simple to install Apache Tomcat in Eclipse.

The steps are mentioned below:

  1. Select Server’s Tab at the bottom side of IDE.
  2. Right, Click on blank space or white space.
  3. Click on New
  4. Click on Servers
  5. Choose Tomcat and its next version.
  6. Click on next
  7. Select the browse button
  8. Select the Tomcat root folder
  9. Click next
  10. Click Add all
  11. Click Finish
  12. Validate the blank area Tomcat must be displaying.

Q #7) How do you start and Stop Apache Tomcat using services?


The services are as follows:

  • Services httpd start
  • Httpd stop

start and Stop Apache Tomcat using services

Q #8) Which is the vital configuration file that is used in Apache Tomcat?

Answer: The vital configuration file that is used in Apache Tomcat is httpd.conf

Q #9) How do you find which version of Apache Tomcat web server is running?


The best way to find which version of Apache Tomcat is running are stated below:

  1. Sign in to the web server
  2. Go to apache instance and bin folder
  3. Run “httpd -v” command to get version detail.


[root@lab sbin] # httpd -v
Server Version: Apache 2.4.18 (Windows)
Server Built: August 2nd, 2018 12.59:00
[root@lab sbin] #

Image result for command to check version of apache tomcat

Q #10) Explain the types of connectors used by Apache Tomcat.

Answer: Apache Tomcat basically uses two types of connectors which are as follows:

  1. HTTP Connectors: HTTP connectors possess attributes which can be modified to determine exactly how it works and access functions such as redirects and proxy forwarding.
  2. AJP Connectors: AJP connectors follow the AJP protocol in place the of HTTP but work just same as HTTP connectors. They are implemented in Apache Tomcat through the plug-in technology mod_jk.

types of connectors used by Apache Tomcat

Q #11) Mention the configuration files of Catalina.

Answer: The configurations files of Catalina include:

  1. XML
  2. Properties
  3. Policy
  4. Tomcat-users.xml

Q #12) What are the vital benefits of Running Tomcat as service?

Answer: The benefits of Running Tomcat as service are:

  • Automatic Startup – If tomcat window service starts up automatically then it would be helpful when we want to start the system remotely.
  • Security – It allows you to execute under a special account which is protected from the other accounts.
  • Starting off the server without active user login: So even if an active user is not then the available server can be started.

Q #13) What is the deployment process of web application using WAR file?

Answer: There is a Web apps directory in Tomcat under which all the web components JSP, Servlets, HTML are placed. Hereby putting all the files into a single folder we can compress the files into a single unit which has .WAR extension.

Now we can easily deploy the web application by putting the WAR file in the Web apps directory.

And when the server starts it extracts all the web components.

Q #14) What is the functionality of Tomcat Valve?

Answer: Tomcat Valve is a new feature which was introduced with Tomcat 4.

Tomcat Valve is used to link an object of Java class with a specific container of Catalina.

Below image shows How Tomcat Valve Works


Q #15) What are the configured Tomcat Valve’s?

Answer: There are basically four configured Tomcat Valves which are mentioned below:

  1. Access Log
  2. Remote Host Filter
  3. Remote Address filter
  4. Request Dumper

Q #16) What do you mean by MAC?

Answer: MAC is nothing but Medium Access Control.

Q #17) What do you mean by Tomcat Coyote and what is its use?

Answer: Tomcat Coyote is basically an HTTP connector based on HTTP/ 1.1 configuration which accepts and sends the web request to the Tomcat engine and again reverts to the client which makes the request.

Q #18) What is the result of Select * from the tab?

Answer: This query would display all the tables that are stored in the database.

Q #19) What is the function of Listen in Apache Tomcat?

Answer: Listen plays a vital role for Apache Tomcat and the developers.

Suppose consider a developer is having multiple IP’s on the server, so if we wish that the Apache should consider only a specified IP then we need to explicitly mention IP and PORT in the Listen Drive.


The below image shows the use of Listen

8.Listen in Apache Tomcat

Q #20) What are the different ways in which we can secure the websites hosted on Tomcat Server?

Answer: There are multiple ways to do it and some of them are mentioned below:

  1. Implementing SSL
  2. Make use of Cloud-based security provider.
  3. Integrating with Web Application Firewall.

Q #21) Do Apache Tomcat generate Log files? If yes name them?

Answer: Yes, Apache Tomcat generates Log files.

Basically, there are two important Log Files which are generated by Apache Tomcat.

They are as follows:

  1. Access.log
  2. Error.log

9Log files

Q #22) How do you justify the significance of Virtual Hosting?

Answer: The concept of virtual hosting plays an important role by allowing to host several websites on a single object.

Virtual hosting can be of IP based and Name based.

#1) Name-Based Virtual Host: It refers that multiple hosts are running on each IP address.

#2) IP Based Virtual Host: It refers that a different IP address exists for each website served.

Name Based Virtual Host is most widely used everywhere.

10Virtual hosting

Q #23) What are the check or log extent provided by Apache Tomcat?

Answer: There are a plenty of check levels provided and out of which “warn” is the default level.

  1. Info
  2. Debug
  3. Warn
  4. Notice
  5. Crit
  6. Alarm
  7. Emerg
  8. Error

Q #24) How is Apache Tomcat different from Apache Web Server?

Answer: Apache Tomcat is used to host the web contents whereas Apache Web server is an HTTP server that is built to serve the static contents.

There is always a possibility to integrate Apache Tomcat and Apache Web Server.

Q #25) Apart from Apache Tomcat, what are the different kinds of Web Servers?

Answer: There are many web servers as mentioned below:

  1. LiteSpeed Web Server
  2. GWS Web Server
  3. Microsoft IIS Web Server
  4. Nginx Web Server
  5. Jigsaw Web Server
  6. Sun Java System Web Server
  7. Lighttpd Web Server

Q #26) Where are the logs of Apache Tomcat stored?


The path is as mentioned below:

Cd/ var/ log/ httpd

Q #27) Which version of Apache have you worked on?

Answer: For this, we can say that we have worked on httpd – 2.2.3

Q #28) What will happen if we have added “logLevel Debug” in httpd. conf file?

Answer: Adding the logLevel Debug provides you with more information in the error log in order to debug an issue.

Q #29) Is it possible to capture the MAC address of the clients who are using your server?

Answer: No, it will not be possible to capture the MAC address of the clients who are using your server.

Q #30) Can we serve Content out of a directory other than the Document Root directory?

Answer: Yes, it is possible to serve the Content out of a directory other than the Document Root directory with the help of “Alias” command.

Q #31) What should we do if we want to know which users are reaching our site?

Answer: We can add the following Log to our activity log format.


Q #32) Is there any chance to cache files which are viewed frequently?

Answer: Yes, there is a chance to cache files which are viewed frequently by using

Mod_file_cache module.

Q #33) How can we put a restriction to upload files on our web server?

Answer: Yes, we can restrict the user to upload files on our web server by using “LimitRequestBody” directive.

Example: LimitRequestBody 20000

Now I have put a limit of 20000 files, so if it's reached then the user will not be able to upload any more files in the server.

Q #34) How can an Apache Service be stopped by its control script?

Answer: The Apache Service is controlled using a script called apachectl.

So, to stop the service, we need to run the below-mentioned commands.

  • #apachectl stop [for Ubuntu based system]
  • # /etc/inid.t/httpd.stop [For red hat based system]

Q #35) What is the significance of status code 403 and 404 in Apache Server?

Answer: The significance of Status code 403 and 404 are mentioned below:

  • Status code 403: It refers to a forbidden error like if a file misses some security context.
  • Status code 404: It refers to an error message that it is an http response and the client was not able to communicate with the given server.

Status Code 404 Image description

11status code 404

Status Code 403 Image description

12status code 403

Q #35) Apache runs as which user and what is the location of the main configuration file?

Answer: Apache runs with a user “nobody” and httpd daemon.

The location of the main configuration file is:

  • # /etc/httpd/conf/httpd.conf
  • # /etcapache2.conf

We wish you all success!!