In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the interview questions about Tomcat". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the interview questions about Tomcat"?
What is Tomcat?
Tomcat is simply a network server running JAVA. The bottom layer is a program of Socket, which is also a container of JSP and Serlvet.
What are the tomcat structure catalogs?
① bin: starts and closes the bat file for tomcat.
② conf: configuration file.
③ server.xml this file is used to configure server-related information, such as the port number for tomcat startup, and to configure the host (Host).
④ web.xml file configuration and web application (web application is equivalent to a web site)
⑤ tomcat-user.xml configures usernames, passwords and related permissions.
⑥ lib: this directory places the jar packages needed to run tomcat.
⑦ logs: stores logs, and when we need to view logs, we can query information.
⑧ webapps: place our web application.
⑨ work working directory: this directory is used to store the corresponding server files and .class files generated after jsp is accessed.
3. How to configure Tomcat virtual directory?
1. Add the following code under the node in server.xml. Path represents the name of the web project entered during access, and docBase represents the absolute path to the site directory.
2, go to the confCatalinalocalhost file, create a xml file, the name of the file is the name of the site.
4. What is the architecture of Tomcat?
Browser-> tomcat server- > service-> connector-> engine (engine)-> host (host)-> web application.
5. What is the request flow of Web requests in Tomcat requests?
① browser enter URL address
② queries native hosts files to find IP
③ query DNS server to find IP
④ sends a Http request to the IP
The ⑤ Tomcat container resolves the hostname
⑥ Tomcat Container parses Web Application
The ⑦ Tomcat container resolves the resource name
⑧ Tomcat Container gets Resources
⑨ Tomcat response browser.
6. How to realize Session sharing in tomcat cluster
Apache cluster implements the Session sharing configuration of Tomcat is actually very simple. There is a detailed description (/ docs/cluster-howto.html) in the documentation that comes with Tomcat, but it is only in English, so combine the following to describe how to configure it:
1. Since it is a cluster, you must prepare several more Tomcat for simulation, such as Tomcat01, Tomcat02 and Tomcat03.
If each Tomcat program is placed on different machines, there will be no port conflicts. If it is on the same machine, simply change a few ports to prevent conflicts caused by port occupancy. Open the server.xml file in the conf folder. The ports that need to be modified are as follows:
1 、
2 、
3 、
The above port needs to be modified, but it is up to you to modify it, as long as there are no port conflicts, and to ensure that there are no port conflicts among various Tomcat instances.
7. What Connector does tomcat have?
Tomcat's Web server connector supports two protocols, AJP and HTTP, which define data transfer between Web server and Tomcat in binary format and provide corresponding control commands.
AJP (Apache JServ Protocol) protocol: the version of the AJP protocol currently in use is AJP13, which is supported through JK and JK2 connectors, which transfers data between Web servers and Tomcat based on binary format, while previous versions of AJP10 and AJP11 use text format to transfer data.
HTTP protocol: as its name suggests, it uses HTTP or HTTPS protocol to establish communication between the Web server and the Tomcat. In this case, Tomcat is a fully functional HTTP server that needs to listen on a port to receive requests from the pre-merchant server.
What is the function of tomcat's Valve?
Valve is similar to a filter in that it can work between Engine and Host/Context, between Host and Context, and between resources in Context and Web applications. Multiple Valve can be created in a container, and the order defined by Valve determines the order in which they take effect.
9. What is the difference between Webserver and Application Server?
The biggest difference is that WebServer generally only refers to the application server of Web (such as servlet,jsp). ApplicationServer can be not only Web, but also other application servers such as Ejb.
The web server can be part of the application server or it can exist alone.
What is the default port of Tomcat and how to modify it?
1) find the conf folder under the Tomcat directory
2) go to the conf folder and find the server.xml file
3) Open the server.xml file
4) find the following information in the server.xml file
Change port= "8080" to the port you want
11. How many ways can Tomcat be deployed?
1) put the Web project directly under webapps, and Tomcat will deploy it automatically
2) configure the node on the server.xml file and set the relevant attributes
3) configure through Catalina: go to the conf\ Catalina\ localhost file and create a xml file whose name is the name of the site. The way you write XML to set it up.
12. How does the tomcat container create servlet class instances? What principle is used?
When the container starts, it reads the web.xml files in all web applications in the webapps directory, then parses the xml files, and reads the servlet registration information. Then, the servlet classes registered in each application are loaded and instantiated by reflection. (sometimes instantiated on the first request) when servlet registers, if it is positive, it is instantiated at the beginning, and if it is not written or is negative, the instantiation is requested for the first time.
Summary of Tomcat top-level architecture
(1) there is only one Server in a Tomcat, a Server can have multiple Service, a Service can have multiple Connector and a Container
(2) Server is in charge of life and death of the whole Tomcat.
(4) Service provides external services.
(5) Connector is used to accept requests and encapsulate them into Request and Response for specific processing.
(6) Container is used to encapsulate and manage Servlet, and specifically handle request requests.
At this point, I believe you have a deeper understanding of "what are the interview questions about Tomcat?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.