Tomcat part ii

5
7/18/2016 Tomcat Middleware Admin Interview Questions https://sites.google.com/site/interviewwebsphere/home/tomcatinterviewquestions 1/5 Middleware Admin Interview Questions Home Websphere Application Server IBM HTTP Server Weblogic Application Server iPlanet/SunOne Web Server Unix General & Basics Acronyms Troubleshooting High CPU Java process on Solaris High CPU Java process on AIX High CPU Java process on Linux Java Basics Tomcat Websphere MQ Sitemap Recent site activity iPlanet/SunOne Web Server comment from Suhas Ingale Websphere Application Server edited by Suhas Ingale Websphere MQ edited by Suhas Ingale Top level attachment from Suhas Ingale Websphere MQ edited by Suhas Ingale View All 829 Home > Tomcat 1) How will you clear the cache of Tomcat server? Ans: The tomcat server keeps a copy of compiled servlets and JSP’s present in all deployed web application at the following location. $Tomcat_ServerworkCatalinalocalhost To clear the cache, you just need to delete the folder corresponding to the web application for which you want to clear the cache. 2) What is Tomcat? Ans: 1) Tomcat is a Java Servlet container and web server from the Jakarta project of the Apache software foundation. 2) A web server responds with web pages to requests from client browsers. 3) Web servers can provide dynamic content based on the requests sent by the user. 4) Tomcat is very good at this because it provides both Java servlet and JavaServerPages (JSP) technologies. 5) Tomcat can also be used as a web server for many applications even if free servlet and JSP engine is wanted. 6) It can be used standalone or used behind traditional web servers such as Apache httpd, with the traditional server serving static pages and Tomcat serving dynamic servlet and JSP requests. 3) What all services are provided by Tomcat? Ans: Tomcat server provides a host of services which are not Search this site

Transcript of Tomcat part ii

Page 1: Tomcat part ii

7/18/2016 Tomcat  Middleware Admin Interview Questions

https://sites.google.com/site/interviewwebsphere/home/tomcatinterviewquestions 1/5

MiddlewareAdminInterviewQuestions

HomeWebsphereApplication ServerIBM HTTP ServerWeblogic ApplicationServeriPlanet/SunOne WebServerUnixGeneral & BasicsAcronymsTroubleshooting

High CPU Javaprocess on SolarisHigh CPU Javaprocess on AIXHigh CPU Javaprocess on Linux

Java BasicsTomcatWebsphere MQSitemap

Recent site activityiPlanet/SunOne WebServercomment from Suhas Ingale

Websphere ApplicationServeredited by Suhas Ingale

Websphere MQedited by Suhas Ingale

Top levelattachment from Suhas Ingale

Websphere MQedited by Suhas Ingale

View All

829

Home  >  

Tomcat

1) How will you clear the cache of Tomcat server?Ans: The tomcat server keeps a copy of compiled servlets andJSP’s present in all deployed web application at the followinglocation.

$Tomcat_ServerworkCatalinalocalhost

To clear the cache, you just need to delete the folder correspondingto the web application for which you want to clear the cache.

2) What is Tomcat?Ans: 1) Tomcat is a Java Servlet container and web server from theJakarta project of the Apache software foundation.2) A web server responds with web pages to requests from clientbrowsers.3) Web servers can provide dynamic content based on therequests sent by the user.4) Tomcat is very good at this because it provides both Java servletand JavaServerPages (JSP) technologies.5) Tomcat can also be used as a web server for many applicationseven if free servlet and JSP engine is wanted.6) It can be used standalone or used behind traditional web serverssuch as Apache httpd, with the traditional server serving staticpages and Tomcat serving dynamic servlet and JSP requests.

3) What all services are provided by Tomcat?Ans: Tomcat server provides a host of services which are not

Search this site

Page 2: Tomcat part ii

7/18/2016 Tomcat  Middleware Admin Interview Questions

https://sites.google.com/site/interviewwebsphere/home/tomcatinterviewquestions 2/5

829days since 

Website Launch

provided by normal web servers like Apache Web Server. Thefollowing is a list of services provided by Tomcat:1) Life cycle Management2) Handling Web Requests3) Thread Management4) Connection pooling5) Clustering

Apart from the above service, you can also tell about the varioustomcat components about which not everyone is aware in detail.

4) How will you create a database connection pool in Tomcatserver?Ans: The steps to configure connection pool:1) Configure pool in context.xml inside conf folder of tomcat.2) Perform a JNDI lookup of pool and get connection from datasource.The JDBC connection pooling page shows how one can createconnection pool in tomcat server.

5) What are the steps to enable SSL in web applicationdeployed on Tomcat?Ans: Read this excellent tutorial on enabling SSL in webapplication deployed on tomcat

6) Can we run multiple instances of Tomcat server on singlemachine? If yes how?Ans: 

7) Suppose there is a clash between the version of librarybeing shipped with your application and the library of Tomcat,How will you resolve it? (Take example of Log4J)Ans: There should be only one jar file for a particular library and ifthere is a clash, you should be using the version of library providedby the server which can avoid problems arising when deploying theapplication on client machines.

8) What is the directory structure of a web applicationdeployed on Tomcat?Ans: The typical web application structure which is deployed on

Page 3: Tomcat part ii

7/18/2016 Tomcat  Middleware Admin Interview Questions

https://sites.google.com/site/interviewwebsphere/home/tomcatinterviewquestions 3/5

tomcat is:

 images js src WEBINF | classes | lib | web.xml index.html

9) How can one enable Hot Deployment in Tomcat?

Ans: 

10) Will you classify Tomcat as web server or applicationserver?Ans: Ideally speaking, tomcat is neither a web server notapplication server because of the following points:

a) Tomcat has servlet and JSP engine present in it which is notprovided by web serversb) Tomcat can not run EJB based applications which can be run byapplication servers.

11) What are the steps to configure clustering in Tomcatserver?Ans: Apache Tomcat wiki lists down the steps for configuringclustering in the guide at Tomcat server clustering

12) How do you define welcome file list?Ans: We can define welcome file list in web.xml deploymentdescriptor by using the welcomefilelist tag as shown in thefollowing sample code:

<welcome‐file‐list>  <welcome‐file>index.html</welcome‐file>  <welcome‐file>index.htm</welcome‐file>  <welcome‐file>index.jsp</welcome‐file></welcome‐file‐list>

The actual welcome file being presented to the user shall be

Page 4: Tomcat part ii

7/18/2016 Tomcat  Middleware Admin Interview Questions

https://sites.google.com/site/interviewwebsphere/home/tomcatinterviewquestions 4/5

decided from the above list. If index.html is present then it shall beshown. If no index.html file is present in the root folder of webapplication, then server tries to find a file with the name index.htmand that also fails then it finds index.jsp.

13) Why is Tomcat not an application server?Ans: Application server is broader term where a host services apartfrom deploying a JSP/Servlet based application are provided.Tomcat is a web server and not application server. This is becauseof the fact that Tomcat doesn’t provide services to install/manageEJB and JMS based applications.

14) How do you create multiple virtual hosts?Ans: If you want tomcat to accept requests for multiple 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 underconf/Catalina/www.myhostname.com/ROOT.xml.Add any parameters specific to this hosts webapp to this contextfile.Put your war file in ${catalina.home}/www/deploy.When tomcat starts, it finds the host entry, then looks for anycontext files and will start any apps with a context.

To add more sites just repeat and rinse, all webapps can share thesame war file location and appbase.

15) What is Jasper?Ans: Jasper is a program to read the .class files in binary format.This program can generate ASCII files , which can be used alongwith Jasmin Assembler. Jasper is intended for generating input intoa class file browser which can produce the hierarchy of inheritanceand composition maps from the .class files.

16) Suppose when we are starting startup.bat file of Tomcatserver it is not started. DOS window appears for a Secondonly. What we need do?

Page 5: Tomcat part ii

7/18/2016 Tomcat  Middleware Admin Interview Questions

https://sites.google.com/site/interviewwebsphere/home/tomcatinterviewquestions 5/5

Ans: Your set up might have been not done well. Make sure youhave added tomcat root directory path in the CATALINA_HOMEenvironment variable and added the bin path in the path variable.

17) How would you set up tomcat for remote debugging?Ans: In windows environment , open up your startup.bat and add tofile somewhere in beginning

rem set remote debuggerset JPDA_ADDRESS=8001set JPDA_TRANSPORT=dt_socketecho Remote debugging started

Add this to end of your startup.sh file

call “%EXECUTABLE%” jpda start%CMD_LINE_ARGS%

Make sure you comment out

call “%EXECUTABLE%” start%CMD_LINE_ARGS%

When you are connecting with eclipse, set your debug port at8001. Now when you start your server , you would see themessage Remote debugging started

Sign in | Recent Site Activity | Report Abuse | Print Page | Powered By  Google Sites

Comments

You do not have permission to add comments.