+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

Tomcat Interview Questions and Answers

What is Tomcat?

Tomcat is a Java Servlet container and web server from Jakartha 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.

Explain what is Jasper?
  • Jasper is a Tomcat’s 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
How do you create multiple virtual hosts?

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.
Explain how running Tomcat as a windows service provides benefits?

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

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.

Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.