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

  1. Question 1. What Is Apache Tomcat?

    Answer :

    Apache Tomcat is an open-source web server and Servlet/JSP container developed by the Apache Software Foundation. Tomcat implements several Java EE specifications including Java Servlet, Java Server Pages (JSP), Java EL, and WebSocket, and provides a "pure Java" HTTP web server environment for Java code to run in.

  2. Question 2. How Do I Can Change The Default Home Page Loaded By Tomcat?

    Answer :

    We can easily override home page via adding welcome-file-list in application $TOMCAT_HOME/webapps//WEB-INF /web.xml file or by editing in container $TOMCAT_HOME/conf/web.xml

    In $TOMCAT_HOME/conf/web.xml, it may look like this: 

    index.html

    index.htm

    index.jsp

    Request URI refers to a directory, the default servlet looks for a "welcome file" within that directory in following order: index.html, index.htm and index.jsp

    If none of these files are found, server renders 404 error.

Question 3. How To We Can Change Tomcat Default Port?

Answer :

8080 is the default HTTP port that Tomcat attempts to bind to at startup.  To change this, we need to change port in $ TOMCAT_HOME /conf/server.xml, in that we can search 8080 and after getting below statement

<Connector port="8080" protocol="HTTP/1.1"  connectionTimeout="20000"  redirectPort="8443" />

We can change 8080 to other port like 8081, we need to restart tomcat to take effect. We required changes in URL as http://localhost:8081/.

Question 4. What Is Default Session Time Out In Tomcat?

Answer :

The default session timeout 30 minutes in tomcat and can change in $TOMCAT_HOME/conf/web.xml via modify below entry

<session-config>

<session-timeout>30</session-timeout>

</session-config>

Question 5. Explain Directory Structure Of Tomcat?

Answer :

Directory structure of Tomcat are:

bin - contain startup, shutdown, and other scripts (*.sh for UNIX and *.bat for Windows systems) and some jar files also there.

conf - Server configuration files (including server.xml) and related DTDs. The most important file in here is server.xml. It is the main configuration file for the container.

lib - contains JARs those are used by container and Servlet and JSP application programming interfaces (APIs).

logs - Log and output files.

webapps – deployed web applications reside in it .

work - Temporary working directories for web applications and mostly used during in JSP compilation where JSP is converted to a Java servlet.

temp - Directory used by the JVM for temporary files .

Question 6. What Is Tomcat?

Answer :

Tomcat is a Java Servlet container and web server from Jakarta project of Apache software foundation. A web server sends web pages as response to the requests sent by the browser client. In addition to the static web pages, dynamic web pages are also sent to the web browsers by the web server. Tomcat is sophisticated in this respect, as it provides both Servlet and JSP technologies. Tomcat provides a good choice as a web server for many web applications and also a free Servlet and JSP engine. Tomcat can be used standalone as well as behind other web servers such as Apache httpd.

Question 7. Explain What Is Jasper?

Answer :

  • Jasper is a Tomcat JSP engine
  • It parses JSP files to compile them into JAVA code as servlets
  • At runtime, Jasper allows to automatically detect JSP file changes and recompile them

Question 8. How Do You Create Multiple Virtual Hosts?

Answer :

If you want tomcat to accept requests for different hosts e.g. www.myhostname.com then you must

  • Create ${catalina.home}/www/appBase , ${catalina.home}/www/deploy, and ${catalina.home}/conf/Catalina/www.myhostname.com
  • Add a host entry in the server.xml file
  • Create the the following file under conf/Catalina/www.myhostname.com/ROOT.xml
  • Add any parameters specific to this hosts webapp to this context file
  • Put your war file in ${catalina.home}/www/deploy
  • When tomcat starts, it finds the host entry, then looks for any context files and will start any apps with a context.

Question 9. Explain How Running Tomcat As A Windows Service Provides Benefits?

Answer :

Running Tomcat as a windows service provides benefits like:

  • Automatic startup: It is crucial for environment where you may want to remotely re-start a system after maintenance
  • Server startup without active user login: Tomcat is run oftenly on blade servers that may not even have an active monitor attached to them. Windows services can be started without an active user
  • Security: Tomcat under window service enables you to run it under a special system account, which is protected from the rest of the user accounts

Question 10. Suppose When We Are Starting Startup.bat File Of Tomcat Server It Is Not Started. Dos Window Appears For A Second Only. What We Need Do?

Answer :

Your set up might have been not done well.

Make sure you have added tomcat root directory path in the CATALINA_HOME environment variable and added the bin path in the path variable.

Question 11. Explain The Concepts Of Tomcat Servlet Container.?

Answer :

  • Tomcat Servlet Container is a servlet container. The servlets runs in servlet container.
  • The implementation of Java Servlet and the Java Server Pages is performed by this container.
  • Provides HTTP web server environment in order to run Java code.
  • Reduces garbage collection
  • Native Windows and Unix wrappers for platform integration

Question 12. Mention What Is The Output Of Select * From Tab?

Answer :

It displays the default tables in the database

Question 13. Can I Set Java System Properties Differently For Each Webapp?

Answer :

No. If you can edit Tomcat's startup scripts, you can add "-D" options to Java. But there is no way to add such properties in web.xml or the webapp's context.

Question 14. Explain How Servlet Life Cycles?

Answer :

The life-cycle of a typical servlet running on Tomcat:

  • Tom-cat receives a request from a client through one of its connectors
  • For processing, this request Tomcat maps this request to appropriate
  • Once the request has been directed to the appropriate servlet, Tomcat verifies that servlet class has been loaded. If it is not than Tomcat wraps the servlet into Java Bytecode, that is executable by the JVM and forms an instance of the servlet
  • Tomcat initiates the servlet by calling its init The servlet contains code that is able to screen Tomcat configuration files and act accordingly, as well as declare any resources it might require
  • Once the servlet has been started, Tomcat can call the servlet’s service method to proceed the request
  • Tomcat and the servlet can co-ordinate or communicate through the use of listener classes during the servlet’s lifecycle, which tracks the servlet for a variety of state changes.
  • To remove the servlet, Tomcat calls the servlets destroy method.

Question 15. How Web Server Handles Multiple Requests For Same Action Class(struts) Concurrently?

Answer :

Struts or any webserver makes new thread for each new request. so multiple request is served with new request object.

Question 16. Explain When You Can Use . And When You Can Use []?

Answer :

If you are running a bean property, use the .operator, and if you are executing a map value or an array index, it is preferred to use the [] operator. Although you can use these operators interchangeably.

Question 17. What Is Webservers? Why It Is Used?

Answer :

Transaction with HTTP request and HTTP response is called webserver.

Using the internet listening the HTTP request and providing the HTTP response is also called webserver.It gives only html output.It will not process business logic .They can provide Http server.They are static.

 

Question 18. Explain What Is Tomcat Coyote?

Answer :

Tom coyote is an HTTP connector based on HTTP/ 1.1 specification which receives and transport web requests to the Tomcat engine by listening to a TCP/IP port and sent request back to the requesting client.

Question 19. How To Communicate Between Two Web Servers In Two Diff Systems?

Answer :

By using plug module .

Question 20. Mention What Are The Connectors Used In Tomcat?

Answer :

In Tomcat, two types of connectors are used:

  1. HTTP Connectors: It has many attributes that can be changed to determine exactly how it works and access functions such as redirects and proxy forwarding
  2. AJP Connectors: It works in the same manner as HTTP connectors, but they practice the AJP protocol in place of HTTP. AJP connectors are commonly implemented in Tomcat through the plug-in technology mod_jk.

Question 21. What Is Different Between Webserver And Application Server?

Answer :

The basic difference between a web server and an application server is Webserver can execute only web applications i,e servlets and JSPs and has only a single container known as Web container which is used to interpret/execute web applications. Application server can execute Enterprise application, i,e (servlets, jsps, and EJBs)

it is having two containers:

  1. Web Container(for interpreting/executing servlets and jsps)
  2. EJB container(for executing EJBs).

it can perform operations like load balancing , transaction demarcation etc.

Question 22. Explain What Does The Mac Stands For?

Answer :

MAC means Medium Access Control

Question 24. Mention With How Many Valves Does Tomcat Configured With?

Answer :

Four types of valves Tomcat is configured with:

  • Access Log
  • Remote Address Filter
  • Remote Host Filter
  • Request Dumper

Question 25. Explain What Is Tomcat Valve?

Answer :

A tomcat valve- a new technology is introduced with Tomcat 4 which enables you to link an instance of a Java class with a specific Catalina container.

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

APACHE TOMCAT INTERVIEW QUESTIONS ANSWERS【转】相关推荐

  1. 35+ Top Apache Tomcat Interview Questions And Answers【转】

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

  2. [转]Design Pattern Interview Questions - Part 2

    Interpeter , Iterator , Mediator , Memento and Observer design patterns. (I) what is Interpreter pat ...

  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. C# Interview Questions and Answers

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

  5. 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 ...

  6. Apache Tomcat 文件包含漏洞(CVE-2020-1938)

    安全公告编号:CNTA-2020-0004 2020年1月6日,国家信息安全漏洞共享平台(CNVD)收录了由北京长亭科技有限公司发现并报送的Apache Tomcat文件包含漏洞(CNVD-2020- ...

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

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

  8. 机器学习面试题合集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 ...

  9. IDEA中找不到maven插件Plugin ‘org.apache.tomcat.maven:tomcat7-maven-plugin:2.2‘ not found

    报错 提示Plugin 'org.apache.tomcat.maven:tomcat7-maven-plugin:2.2' not found 解决方法 参考https://stackoverflo ...

最新文章

  1. Hutool,一个贼好用的 Java 工具类库,用过都说好~
  2. start ssh-agent
  3. 如何看懂发电机功率圆图
  4. 大学计算机技术类社团/组织——社团官方网站
  5. 聚合(根)、实体、值对象精炼思考总结
  6. 服务器应用缓存热点问题思考
  7. 大数据城市规划 杨东_AI为智慧城市规划做建设
  8. android 分页列表,android获取相册列表并分页获取
  9. server.mappath 与page命名空间说明
  10. 植被农业数据下载网站整理
  11. Android实现截屏功能(已适配Android11)
  12. 第三方定量定性质谱检测技术实验
  13. QT windows ICO图标制作方法
  14. Word表格内数据换行,Word换行Java实现代码
  15. 手机连接电脑后,QT的QDIR怎么读取手机文件路径
  16. 中普审计系统无法连接服务器,中普审计信息系统内审版-简单操作说明大全.doc...
  17. cass简码大全_考考你......列出 南方cass 简码指令50个。
  18. python(decorator)
  19. DSP CCS3.3安装问题与解决方案
  20. Leetcode刷题149. 直线上最多的点数

热门文章

  1. es mysql延迟_ES 近实时搜索 更新延迟问题
  2. python语言面试基础_【python面试指北】1.语言基础
  3. win命令安装 安装cmake_win10下VSCode+CMake+Clang+GCC环境搭建教程图解
  4. cpu序列号能告诉别人嘛_微信这个开关不删除,别人手机能随意登录你的微信,学会告诉家人...
  5. qt布局嵌套_PyQt5 笔记(01):嵌套布局
  6. 索引文件核心头文件定义
  7. kylin linux 安装教程,新手入门必备:kylin安装教程介绍!
  8. android 之Activity间的相互跳转(通过intent构造函数)
  9. CCF 2020年题目题解 - Python
  10. tf.dtypes.cast