{"id":26601,"date":"2022-02-11T12:32:33","date_gmt":"2022-02-11T12:32:33","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=26601"},"modified":"2022-04-13T16:57:11","modified_gmt":"2022-04-13T16:57:11","slug":"top-50-apache-tomcat-interview-questions-and-answers","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/top-50-apache-tomcat-interview-questions-and-answers\/","title":{"rendered":"Top 50 Apache tomcat interview questions and answers"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/777441613.png\" alt=\"\" class=\"wp-image-26649\" width=\"711\" height=\"404\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/777441613.png 818w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/777441613-300x171.png 300w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2022\/02\/777441613-768x437.png 768w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><figcaption><em><strong>Apache Tomcat<\/strong><\/em><\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"1-what-is-apache-tomcat\">1) What is Apache Tomcat?<\/h2>\n\n\n\n<p>Apache Tomcat is basically a Web Server and Servlet system which is an open-source (i.e. freely available on the internet) and is created by Apache Software Foundation. It is the server mostly used by Java Developers.<\/p>\n\n\n\n<p>The server is nothing but a computer program that provides service to other computers.<\/p>\n\n\n\n<p>There are basically two types of server:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Application Server\nWeb Server<\/code><\/span><\/pre>\n\n\n<p>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.<\/p>\n\n\n\n<p>This is very easy and simple to install and is compatible with any Operating System.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2-why-do-we-require-apache-tomcat\">2) Why do we require Apache Tomcat?<\/h2>\n\n\n\n<p>Answer: It is required to run Java Web Applications on the host and server-based systems. It also helps to run JSP and Servlets.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3-what-is-the-name-of-inbuilt-web-container-in-tomcat\">3) What is the name of inbuilt Web Container in Tomcat?<\/h2>\n\n\n\n<p id=\"3-what-is-the-name-of-inbuilt-web-container-in-tomcat\">The name of the inbuilt Web Container in Tomcat is Catalina which is present in the bin directory.<\/p>\n\n\n\n<p>Catalina is used for loading all the requests related to HTTP and can instantiate the objects of GET () and POST () methods.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4-what-are-the-types-of-batch-file-with-the-help-of-which-we-can-start-and-stop-apache-tomcat-server\">4) What are the types of batch file with the help of which we can Start and Stop Apache Tomcat Server?<\/h2>\n\n\n\n<p> There are basically two types of batch files with which we can Start and Stop the Server.<\/p>\n\n\n\n<p>They are as follows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">Startup<\/span><span class=\"hljs-selector-class\">.bat<\/span>\n<span class=\"hljs-selector-tag\">Shutdown<\/span><span class=\"hljs-selector-class\">.bat<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"5-which-is-the-vital-configuration-file-that-is-used-in-apache-tomcat\">5) Which is the vital configuration file that is used in Apache Tomcat?<\/h2>\n\n\n\n<p>Answer: The vital configuration file that is used in Apache Tomcat is httpd.conf<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"6-mention-the-configuration-files-of-catalina\">6) Mention the configuration files of Catalina.<\/h2>\n\n\n\n<p> The configurations files of Catalina include:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">XML<\/span>\n<span class=\"hljs-selector-tag\">Properties<\/span>\n<span class=\"hljs-selector-tag\">Policy<\/span>\n<span class=\"hljs-selector-tag\">Tomcat-users<\/span><span class=\"hljs-selector-class\">.xml<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"7-what-are-the-vital-benefits-of-running-tomcat-as-service\">7) What are the vital benefits of Running Tomcat as service?<\/h2>\n\n\n\n<p> The benefits of Running Tomcat as service are:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Automatic Startup \u2013 If tomcat <span class=\"hljs-built_in\">window<\/span> service starts up automatically then it would be helpful when we want to start the system remotely.\nSecurity \u2013 It allows you to execute under a special account which is protected <span class=\"hljs-keyword\">from<\/span> the other accounts.\nStarting off the server without active user login: So even <span class=\"hljs-keyword\">if<\/span> there is no active user, the available server can be started.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"8-what-is-the-deployment-process-of-web-application-using-the-war-file\">8) What is the deployment process of web application using the WAR file?<\/h2>\n\n\n\n<p> 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.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"9-what-are-the-configured-tomcat-valve-s\">9) What are the configured Tomcat Valve\u2019s?<\/h2>\n\n\n\n<p>There are basically four configured Tomcat Valves which are mentioned below:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Access Log\nRemote Host Filter\nRemote Address filter\nRequest Dumper<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"10-what-do-you-mean-by-tomcat-coyote-and-what-is-its-use\">10) What do you mean by Tomcat Coyote and what is its use?<\/h2>\n\n\n\n<p> 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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"11-what-are-the-different-ways-in-which-we-can-secure-the-websites-hosted-on-tomcat-server\">11) What are the different ways in which we can secure the websites hosted on Tomcat Server?<\/h2>\n\n\n\n<p>Answer: There are multiple ways to do it and some of them are mentioned below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Implementing SSL\nMake use <span class=\"hljs-keyword\">of<\/span> Cloud-based security provider.\nIntegrating <span class=\"hljs-keyword\">with<\/span> Web Application Firewall.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"12-how-is-apache-tomcat-different-from-apache-web-server\">12) How is Apache Tomcat different from Apache Web Server?<\/h2>\n\n\n\n<p id=\"12-how-is-apache-tomcat-different-from-apache-web-server\"> 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.<\/p>\n\n\n\n<p>There is always a possibility to integrate Apache Tomcat and Apache Web Server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"13-apart-from-apache-tomcat-what-are-the-different-kinds-of-web-servers\">13) Apart from Apache Tomcat, what are the different kinds of Web Servers?<\/h2>\n\n\n\n<p>There are many web servers as mentioned below:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">LiteSpeed Web Server\nGWS Web Server\nMicrosoft IIS Web Server\nNginx Web Server\nJigsaw Web Server\nSun Java System Web Server\nLighttpd Web Server<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"14-which-version-of-apache-have-you-worked-on\">14) Which version of Apache have you worked on?<\/h2>\n\n\n\n<p> For this, we can say that we have worked on httpd \u2013 2.2.3<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"15-what-will-happen-if-we-have-added-loglevel-debug-in-httpd-conf-file\">15) What will happen if we have added \u201clogLevel Debug\u201d in httpd. conf file?<\/h2>\n\n\n\n<p> Adding the logLevel Debug provides you with more information in the error log in order to debug an issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"16-can-we-serve-content-out-of-a-directory-other-than-the-document-root-directory\">16) Can we serve Content out of a directory other than the Document Root directory?<\/h2>\n\n\n\n<p>Yes, it is possible to serve the Content out of a directory other than the Document Root directory with the help of \u201cAlias\u201d command.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"17-is-there-any-chance-to-cache-files-which-are-viewed-frequently\">17) Is there any chance to cache files which are viewed frequently?<\/h2>\n\n\n\n<p id=\"17-is-there-any-chance-to-cache-files-which-are-viewed-frequently\">Yes, there is a chance to cache files which are viewed frequently by using<\/p>\n\n\n\n<p>Mod_file_cache module.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"18-how-can-we-put-a-restriction-to-upload-files-on-our-web-server\">18) How can we put a restriction to upload files on our web server?<\/h2>\n\n\n\n<p>Yes, we can restrict the user to upload files on our web server by using the \u201cLimitRequestBody\u201d directive.<\/p>\n\n\n\n<p>Example: LimitRequestBody 20000<\/p>\n\n\n\n<p>Now I have put a limit of 20000 files, so when this mark is reached then the user will not be able to upload any more files in the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"19-how-can-an-apache-service-be-stopped-by-its-control-script\">19) How can an Apache Service be stopped by its control script?<\/h2>\n\n\n\n<p>The Apache Service is controlled using a script called the apachectl.<\/p>\n\n\n\n<p>So, to stop the service, we need to run the below-mentioned commands.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\">#apachectl stop &#91;for Ubuntu based system]<\/span>\n<span class=\"hljs-comment\"># \/etc\/inid.t\/httpd.stop &#91;for red hat based system]<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"20-apache-runs-as-which-user-and-what-is-the-location-of-the-main-configuration-file\">20) Apache runs as which user and what is the location of the main configuration file?<\/h2>\n\n\n\n<p>Apache runs with a user \u201cnobody\u201d and httpd daemon.<\/p>\n\n\n\n<p>The location of the main configuration file is:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-comment\"># \/etc\/httpd\/conf\/httpd.conf<\/span>\n<span class=\"hljs-comment\"># \/etcapache2.conf<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"21-what-is-default-session-time-out-in-tomcat\">21) What Is Default Session Time Out In Tomcat?<\/h2>\n\n\n\n<p>The default session timeout 30 minutes in tomcat and can change in $TOMCAT_HOME\/conf\/web.xml via modify below entry<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">session-config<\/span>&gt;<\/span>\n\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">session-timeout<\/span>&gt;<\/span>30<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">session-timeout<\/span>&gt;<\/span>\n\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">session-config<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"22-what-is-default-session-time-out-in-tomcat\">22) What Is Default Session Time Out In Tomcat<\/h2>\n\n\n\n<p>The default session timeout 30 minutes in tomcat and can change in $TOMCAT_HOME\/conf\/web.xml via modify below entry<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">session-config<\/span>&gt;<\/span>\n\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">session-timeout<\/span>&gt;<\/span>30<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">session-timeout<\/span>&gt;<\/span>\n\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">session-config<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"23-how-do-you-create-multiple-virtual-hosts\">23) How Do You Create Multiple Virtual Hosts?<\/h2>\n\n\n\n<p>If you want tomcat to accept requests for different hosts e.g. www.myhostname.com then you must<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-9\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Create ${catalina.home}\/www\/appBase , ${catalina.home}\/www\/deploy, and ${catalina.home}\/conf\/Catalina\/www.myhostname.com\nAdd a host entry <span class=\"hljs-keyword\">in<\/span> the server.xml file\nCreate the the following file under conf\/Catalina\/www.myhostname.com\/ROOT.xml\nAdd any parameters specific to <span class=\"hljs-keyword\">this<\/span> hosts webapp to <span class=\"hljs-keyword\">this<\/span> context file\nPut your war file <span class=\"hljs-keyword\">in<\/span> ${catalina.home}\/www\/deploy\nWhen tomcat starts, it finds the host entry, then looks <span class=\"hljs-keyword\">for<\/span> any context files and will start any apps <span class=\"hljs-keyword\">with<\/span> a context.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-9\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"24-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\">24) 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?<\/h2>\n\n\n\n<p>Your set up might have been not done well.<\/p>\n\n\n\n<p>Make sure you have added tomcat root directory path in the CATALINA_HOME environment variable and added the bin path in the path variable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"25-how-do-i-can-change-the-default-home-page-loaded-by-tomcat\">25) How Do I Can Change The Default Home Page Loaded By Tomcat?<\/h2>\n\n\n\n<p>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<\/p>\n\n\n\n<p>In $TOMCAT_HOME\/conf\/web.xml, it may look like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-10\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">index<\/span><span class=\"hljs-selector-class\">.html<\/span>\n\n<span class=\"hljs-selector-tag\">index<\/span><span class=\"hljs-selector-class\">.htm<\/span>\n\n<span class=\"hljs-selector-tag\">index<\/span><span class=\"hljs-selector-class\">.jsp<\/span> <\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-10\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Request URI refers to a directory, the default servlet looks for a &#8220;welcome file&#8221; within that directory in following order: index.html, index.htm and index.jsp<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"26-how-to-we-can-change-tomcat-default-port\">26) How To We Can Change Tomcat Default Port?<\/h2>\n\n\n\n<p>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<\/p>\n\n\n\n<p>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\/.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"27-what-is-default-session-time-out-in-tomcat\">27) What Is Default Session Time Out In Tomcat?<\/h2>\n\n\n\n<p>The default session timeout 30 minutes in tomcat and can change in $TOMCAT_HOME\/conf\/web.xml via modify below entry<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-11\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\"><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">session-config<\/span>&gt;<\/span>\n\n    <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">session-timeout<\/span>&gt;<\/span>30<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">session-timeout<\/span>&gt;<\/span>\n\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">session-config<\/span>&gt;<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-11\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"28-how-do-you-create-multiple-virtual-hosts\">28) How Do You Create Multiple Virtual Hosts?<\/h2>\n\n\n\n<p>If you want tomcat to accept requests for different hosts e.g. www.myhostname.com then you must<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-12\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Create ${catalina.home}\/www\/appBase , ${catalina.home}\/www\/deploy, and ${catalina.home}\/conf\/Catalina\/www.myhostname.com\nAdd a host entry <span class=\"hljs-keyword\">in<\/span> the server.xml file\nCreate the the following file under conf\/Catalina\/www.myhostname.com\/ROOT.xml\nAdd any parameters specific to <span class=\"hljs-keyword\">this<\/span> hosts webapp to <span class=\"hljs-keyword\">this<\/span> context file\nPut your war file <span class=\"hljs-keyword\">in<\/span> ${catalina.home}\/www\/deploy\nWhen tomcat starts, it finds the host entry, then looks <span class=\"hljs-keyword\">for<\/span> any context files and will start any apps <span class=\"hljs-keyword\">with<\/span> a context.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-12\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"29-explain-what-is-the-purpose-of-nat-protocol\">29) Explain what is the purpose of NAT protocol?<\/h2>\n\n\n\n<p>The purpose of NAT protocol is to hide private IP address from public IP address and give a certain level of security to the organization.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"30-explain-the-concepts-of-tomcat-servlet-container\">30) Explain The Concepts Of Tomcat Servlet Container.?<\/h2>\n\n\n\n<p><\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-13\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Tomcat Servlet Container is a servlet container. The servlets runs <span class=\"hljs-keyword\">in<\/span> servlet container.\nThe implementation <span class=\"hljs-keyword\">of<\/span> Java Servlet and the Java Server Pages is performed by <span class=\"hljs-keyword\">this<\/span> container.\nProvides HTTP web server environment <span class=\"hljs-keyword\">in<\/span> order to run Java code.\nReduces garbage collection\nNative Windows and Unix wrappers <span class=\"hljs-keyword\">for<\/span> platform integration<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-13\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"31-can-i-set-java-system-properties-differently-for-each-webapp\"> 31) Can I Set Java System Properties Differently For Each Webapp?<\/h2>\n\n\n\n<p>No. If you can edit Tomcat&#8217;s startup scripts, you can add &#8220;-D&#8221; options to Java. But there is no way to add such properties in web.xml or the webapp&#8217;s context.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"32-how-web-server-handles-multiple-requests-for-same-action-class-struts-concurrently\">32) How Web Server Handles Multiple Requests For Same Action Class(struts) Concurrently?<\/h2>\n\n\n\n<p>Struts or any webserver makes new thread for each new request. so multiple request is served with new request object.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"33-explain-when-you-can-use-and-when-you-can-use\">33) Explain When You Can Use . And When You Can Use []?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"34-what-is-webservers-why-it-is-used\">34) What Is Webservers? Why It Is Used?<\/h2>\n\n\n\n<p>Transaction with HTTP request and HTTP response is called webserver.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"35-explain-what-is-tomcat-coyote\">35) Explain What Is Tomcat Coyote?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"36-mention-what-are-the-connectors-used-in-tomcat\">36) Mention What Are The Connectors Used In Tomcat?<\/h2>\n\n\n\n<p>In Tomcat, two types of connectors are used:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-14\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">HTTP Connectors: It has many attributes that can be changed to determine exactly how it works and access functions such <span class=\"hljs-keyword\">as<\/span> redirects and proxy forwarding\nAJP Connectors: It works <span class=\"hljs-keyword\">in<\/span> the same manner <span class=\"hljs-keyword\">as<\/span> HTTP connectors, but they practice the AJP protocol <span class=\"hljs-keyword\">in<\/span> place <span class=\"hljs-keyword\">of<\/span> HTTP. AJP connectors are commonly implemented <span class=\"hljs-keyword\">in<\/span> Tomcat through the plug-<span class=\"hljs-keyword\">in<\/span> technology mod_jk.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-14\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"37-what-is-different-between-webserver-and-application-server\">37) What Is Different Between Webserver And Application Server?<\/h2>\n\n\n\n<p>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)<\/p>\n\n\n\n<p>it is having two containers:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Web Container(for interpreting\/executing servlets and jsps)\nEJB container(for executing EJBs).<\/code><\/span><\/pre>\n\n\n<p>it can perform operations like load balancing , transaction demarcation etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"38-explain-when-to-use-ssl-with-tomcat\">38) Explain When To Use Ssl With Tomcat?<\/h2>\n\n\n\n<p>You would use Tomcat to handle connection, when you are running Tomcat as a stand-alone web server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"39-mention-with-how-many-valves-does-tomcat-configured-with\">39) Mention With How Many Valves Does Tomcat Configured With?<\/h2>\n\n\n\n<p>Four types of valves Tomcat is configured with:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Access Log\nRemote Address Filter\nRemote Host Filter\nRequest Dumper<\/code><\/span><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"40-explain-what-is-tomcat-valve\">40) Explain What Is Tomcat Valve?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"41-can-i-set-java-system-properties-differently-for-each-webapp\">41) Can I Set Java System Properties Differently For Each Webapp?<\/h2>\n\n\n\n<p>No. If you can edit Tomcat&#8217;s startup scripts, you can add &#8220;-D&#8221; options to Java. But there is no way to add such properties in web.xml or the webapp&#8217;s context.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"42-how-to-communicate-between-two-web-servers-in-two-diff-systems\">42) How To Communicate Between Two Web Servers In Two Diff Systems?<\/h2>\n\n\n\n<p>Answer :<\/p>\n\n\n\n<p>By using plug module<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"43-mention-what-is-the-output-of-select-from-tab\">43) Mention What Is The Output Of Select * From Tab?<\/h2>\n\n\n\n<p>It displays the default tables in the database.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"44-explain-how-you-can-configure-tomcat-to-work-with-iis-and-ntlm\">44) Explain how you can configure Tomcat to work with IIS and NTLM?<\/h2>\n\n\n\n<p>You have to follow the standard instructions for when the isapi_redirector.dll<\/p>\n\n\n\n<p>Configure IIS to use \u201cintegrated windows security\u201d<\/p>\n\n\n\n<p>Ensure that in the server.xml you have disable tomcat authentication<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"45-explain-when-you-can-use-and-when-you-can-use\">45) Explain when you can use . and when you can use []?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"46-mention-what-is-the-default-port-for-tomcat\">46) Mention what is the default port for Tomcat?<\/h2>\n\n\n\n<p>The default port for Tomcat is 8080. After initialising Tomcat on your local machine, you can verify if Tomcat is running the URL: http:\/\/localhost:8080<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"47-mention-what-are-the-connectors-used-in-tomcat\">47) Mention what are the connectors used in Tomcat?<\/h2>\n\n\n\n<p>In Tomcat, two types of connectors are used<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-15\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">HTTP Connectors: It has many attributes that can be changed to determine exactly how it works and access functions such <span class=\"hljs-keyword\">as<\/span> redirects and proxy forwarding\nAJP Connectors: It works <span class=\"hljs-keyword\">in<\/span> the same manner <span class=\"hljs-keyword\">as<\/span> HTTP connectors, but they practice the AJP protocol <span class=\"hljs-keyword\">in<\/span> place <span class=\"hljs-keyword\">of<\/span> HTTP. AJP connectors are commonly implemented <span class=\"hljs-keyword\">in<\/span> Tomcat through the plug-<span class=\"hljs-keyword\">in<\/span> technology mod_jk.<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-15\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"48-explain-how-running-tomcat-as-a-windows-service-provides-benefits\">48) Explain how running Tomcat as a windows service provides benefits?<\/h2>\n\n\n\n<p>Running Tomcat as a windows service provides benefits like<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-16\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\">Automatic startup: It is crucial <span class=\"hljs-keyword\">for<\/span> environment where you may want to remotely re-start a system after maintenance\nServer 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\n<span class=\"hljs-attr\">Security<\/span>: Tomcat under <span class=\"hljs-built_in\">window<\/span> service enables you to run it under a special system account, which is protected <span class=\"hljs-keyword\">from<\/span> the rest <span class=\"hljs-keyword\">of<\/span> the user accounts<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-16\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"49-explain-how-you-can-deploy-a-web-application-using-war-files\">49) Explain how you can deploy a web application using WAR files?<\/h2>\n\n\n\n<p>JSPs, servlets, and their supporting files are placed in the proper subdirectories under the web apps directory in Tomcat. You can make all the files under the web apps directory into one compressed file, which ends with .war file extension. You can execute a web application by placing a WAR file in the webapps directory. When a web server starts executing, it pulls out the WAR file\u2019s contents into the appropriate webapps sub-directories.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"50-explain-what-is-tomcat-valve\">50) Explain what is Tomcat Valve?<\/h2>\n\n\n\n<p>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.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"related-video\">Related video:<\/h4>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\"  id=\"_ytid_25528\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/u_InEBgRVcc?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  epyt-is-override  no-lazyload\" title=\"YouTube player\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\"><\/code><\/span><\/pre>","protected":false},"excerpt":{"rendered":"<p>1) What is Apache Tomcat? Apache Tomcat is basically a Web Server and Servlet system which is an open-source (i.e. freely available on the internet) and is created by Apache&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[5908,52],"tags":[420,310,282,220,3347,401,250,594,2756,381,6046,939],"class_list":["post-26601","post","type-post","status-publish","format-standard","hentry","category-tomcat","category-interview-questions-answers","tag-apache","tag-application","tag-configuration","tag-deployment","tag-interview-questions-answers","tag-protocol","tag-service","tag-tomcat","tag-tomcat-server","tag-version","tag-virtualhost","tag-websites"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/26601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=26601"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/26601\/revisions"}],"predecessor-version":[{"id":26652,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/26601\/revisions\/26652"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=26601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=26601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=26601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}