原文地址:https://www.softwaretestinghelp.com/apache-tomcat-interview-questions/

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.

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.

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.

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?

Answer:

The services are as follows:

  • Services httpd start
  • Httpd stop

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?

Answer:

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.

Output:

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

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.

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.

Example: 10.10.10.20

The below image shows the use of Listen

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

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.

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?

Answer:

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.

%{Referer}

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

Status Code 403 Image description

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!!

转载于:https://www.cnblogs.com/davidwang456/articles/11267621.html

35+ Top Apache Tomcat Interview Questions And Answers【转】相关推荐

  1. APACHE TOMCAT INTERVIEW QUESTIONS ANSWERS【转】

    原文地址:https://www.wisdomjobs.com/e-university/apache-tomcat-interview-questions.html Question 1. What ...

  2. C# Interview Questions and Answers

    What's C# ?C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived f ...

  3. English job interview Questions and Answers

    "What are your goals for the future?" or "Where do you see yourself in five years?&qu ...

  4. iOS interview questions and Answers

    http://gksanthoshbe.blogspot.com/2013/03/ios-interview-questions-and-answers.html 1-How would you cr ...

  5. 面试时最经常被问到的问题(Frenquently asked interview questions)(II)

    面试时最经常被问到的问题(Frenquently asked interview questions)(II) 面试时最经常被问到的问题(Frenquently asked interview que ...

  6. java.lang.NoClassDefFoundError: org/apache/tomcat/util/res/StringManager

    java.lang.NoClassDefFoundError: org/apache/tomcat/util/res/StringManager 一个比较老的web项目,  IDEA 导入后不能用,  ...

  7. 机器学习面试题合集Collection of Machine Learning Interview Questions

    The Machine Learning part of the interview is usually the most elaborate one. That's the reason we h ...

  8. apache+tomcat 搭建负载均衡系统

    apache+tomcat+mod_jk 搭建负载均衡系统. 0.os系统采用centos6.8 x64 2.6.32-642.el6.x86_64 1.首先安装好jdk环境本次采用jdk-8u111 ...

  9. org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60

    今天发现一个很奇怪的问题:org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constan ...

最新文章

  1. 新年开工——相关性分析了解一下?
  2. db2 CLP中如何换行啊
  3. iso8601时间格式_ISO8601与dayjs的使用
  4. android 绘制5格电量,Android 如何把状态栏信号格改为5格
  5. Unity 2017 Game Optimization 读书笔记 Dynamic Graphics (6)
  6. jquery上传图片插件(支持各种功能)
  7. caffe中Makefile.config配置
  8. High Score
  9. linux sd卡 测试软件,怎么检测SD卡内存卡是否被扩容过?
  10. 小白黑苹果安装N卡的方法和安装驱动后开机黑屏的解决方法
  11. 4071 国际象棋(枚举)
  12. 【NLP】非监督文本匹配算法——BM25
  13. FPGA,verilog驱动VGA显示
  14. 属性的遍历:for...in 循环
  15. 编译原理——语法制导翻译并产生中间代码(while,复合语句和过程调用语句的翻译)
  16. Linux 通过ISCSI挂载v3500外置存储
  17. 双ram口多模块存储器_RAM模块上的灰色小东西是什么?
  18. 16.Excel vba开发-计算所选中区域之和
  19. 2013年9月4日第一篇CSDN个人博客
  20. html页面中常用标记,收集的web页面html中常用的特殊符号大全

热门文章

  1. 第二模块_找钱:融资与管理_1
  2. 《剑指offer》c++版本 15.二进制中1的个数
  3. Linux信号 六 信号与线程的关系
  4. 理想内插_理想ONE性能测试:6.35秒就能破百,售价只要宝马X5一半
  5. 初学者用涩性胶皮好还是粘性_乒乓球胶皮的保养方法
  6. 量子计算机模型取,Grover算法在单道量子计算模型下的实现
  7. d3.js 旋转图形_几何画板第9期图形的组合型运动
  8. 文本编辑器实现打开帮助文件的功能
  9. php导出excel2007实例,PHPExcel精简版与导入导出案例
  10. 同事查询多行_从零学会SQL-简单查询