Tomcat Server


Published on

The internals of Tomcat and how to configure and customise its behaviour.

Published in: Technology
1 Comment
  • hey hi ............ i m ashish singh i m an final yr. engi. student ........i hv urgent need of ppt over this project.......please sent me this ppt to my mail id it is ( .........thnk u.......
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Tomcat Server

  1. 1. Of Tomcat s and JBoss es
  2. 2. What’s in store… <ul><li>Getting started </li></ul><ul><li>Configuring Tomcat </li></ul><ul><li>Web application deployment </li></ul><ul><li>Integrating with Apache </li></ul><ul><li>Tomcat security </li></ul><ul><li>Configuration files </li></ul><ul><li>JBoss 4.2 server structure </li></ul><ul><li>JBoss server profiles </li></ul><ul><li>Deploying in a JBoss server </li></ul><ul><li>… .. </li></ul>
  3. 3. O R I G I N S <ul><li>In 1999 Sun donated its servlet container to Apache S/w Foundation </li></ul><ul><li>Combined with the Apache web-server </li></ul><ul><li>A new servlet and JSP specification leads to a new Tomcat version </li></ul><ul><li>2001 - Tomcat Catalina, fully-redesigned, is released. Version 4.x </li></ul><ul><li>1999 – JBoss server released </li></ul><ul><li>Both are available as open-source </li></ul>
  4. 4. Tomcat – A Bird’s View <ul><li>Servlet containers handle requests for service by… </li></ul><ul><li>Creating a request object and populating it with appropriate information </li></ul><ul><li>Creating a response object that can be used to produce the response to the requester </li></ul><ul><li>Calling a service method to translate the request object data to the response object </li></ul>
  5. 5. Tomcat - F R A M E W O R K Tomcat - Server AJP Connector 8080 SSL Connector 8080 Coyote Connector 8080 Service Engine – Catalina Host Context Servlet JSP Logger Valve Valve Valve Realm
  6. 6. Tomcat - F R A M E W O R K <ul><li>Consists of Components </li></ul><ul><li>Containers – components which contain other components </li></ul><ul><li>Nested components – components which can’t contain other components </li></ul><ul><li>Server an instance of Tomcat web application server </li></ul><ul><li>Service manages connectors between client and server components </li></ul><ul><li>Connectors represent points at which requests are received and assigned to a port </li></ul><ul><li>Engine represents Catalina Servlet engine </li></ul><ul><ul><li>Examines HTTP headers and determines contexts </li></ul></ul><ul><ul><li>Over-ridden when Tomcat is part of other Web/App server </li></ul></ul><ul><li>Realm manages authentication and authorisation </li></ul><ul><li>Valves intercept requests and do pre-processing. Eg. – Single sign-on </li></ul>
  7. 7. Tomcat - F R A M E W O R K <ul><li>So basically … </li></ul><ul><li>Tomcat is the web server </li></ul><ul><li>Catalina is the servlet container in Tomcat </li></ul><ul><li>Catalina has two main modules: </li></ul><ul><ul><li>A connector to connect the request to the container. It constructs the request object and the response object. </li></ul></ul><ul><ul><li>A container, which actually services the request. </li></ul></ul>
  8. 8. Getting S T A R T E D with Tomcat <ul><li> </li></ul><ul><ul><li>xx – major version + minor version </li></ul></ul><ul><li>Best to download the ZIP archive </li></ul><ul><li>Running Tomcat </li></ul><ul><ul><li>bin/startup.[bat/sh] </li></ul></ul><ul><li>Stopping Tomcat </li></ul><ul><ul><li>bin/shutdown.[bat/sh] </li></ul></ul>
  9. 9. C O N F I G U R I N G Tomcat <ul><li>conf/server.xml – the starting point </li></ul><ul><li>Change all ports – HTTP(S), Shutdown, AJP </li></ul><ul><li>Web application security – users, passwords & roles managed by Realm </li></ul><ul><li>Using with another web server like Apache </li></ul><ul><li>Specifying JNDI resources in Engine </li></ul><ul><li>Enable access logs </li></ul><ul><li>bin/catalina.bat – specifying JVM parameters and arguments </li></ul><ul><li>conf/web.xml – default options for all web applications </li></ul>
  10. 10. A H – H A H Moment <ul><li>So, Why can’t you run multiple Tomcats on the same machine? What if have to ? </li></ul>
  11. 11. Tomcat A D M I N <ul><li>Host-manager web application should be deployed </li></ul><ul><li>Roles, usernames and passwords present in conf/tomact-users.xml </li></ul><ul><li>Access http://localhost:8080 and click on Manager </li></ul><ul><li>Deployment of web applications can be done remotely </li></ul>
  12. 12. D E P L O Y I N G Web Application <ul><li>Can be done manually or automagically </li></ul><ul><li>Not to forget – through Eclipse ! </li></ul><ul><li>Manual – place the *.war file within the ‘ webapps ’ folder </li></ul><ul><li>Automagic – use the Admin console to deploy the *.war </li></ul><ul><li>Eclipse – add new server, deploy application onto server </li></ul>
  13. 13. Web Application Layout <ul><li>sample_webapp/ </li></ul><ul><ul><li>xxx.html </li></ul></ul><ul><ul><li>yyy.jsp </li></ul></ul><ul><ul><li>zzz.other resources </li></ul></ul><ul><ul><li>WEB-INF/ </li></ul></ul><ul><ul><ul><li>web.xml </li></ul></ul></ul><ul><ul><ul><li>classes/ </li></ul></ul></ul><ul><ul><ul><ul><li>Java class files </li></ul></ul></ul></ul><ul><ul><ul><li>lib/ </li></ul></ul></ul><ul><ul><ul><ul><li>jars and zips of class files </li></ul></ul></ul></ul>
  14. 14. L O A D B A L A N C I N G Tomcat Tomcat Tomcat Tomcat R E Q U E S T S Apache Web Server Tomcat Cluster
  15. 15. L O A D B A L A N C I N G <ul><li>Deploy particular web application on Tomcats </li></ul><ul><li>Tomcats behind Apache web server </li></ul><ul><li>Apache web server – </li></ul><ul><ul><li>httpd.conf – load Tomcat application </li></ul></ul><ul><ul><li>Create file </li></ul></ul><ul><ul><li>Each worker should point to IP & port of particular Tomcat machine </li></ul></ul><ul><li>Tomcat servers – </li></ul><ul><ul><li>Modify server.xml – add ‘jvmRoute’ to ‘Engine’ tag </li></ul></ul><ul><ul><li>Each jvmRoute should be the name of the corresponding Apache worker </li></ul></ul>
  16. 16. S E C U R I N G the system! <ul><li>Did someone say Windows? </li></ul><ul><li>Close unwanted open ports </li></ul><ul><li>Block private and internal ports: </li></ul><ul><ul><li>Control port: 8005 </li></ul></ul><ul><ul><li>Connector port: 8009 </li></ul></ul><ul><ul><li>Anything else you don’t need. </li></ul></ul><ul><ul><li>Tomcat usually runs on 8080, so leave it open </li></ul></ul><ul><ul><li>If you have Apache running, you’ll need port 80 open, as well </li></ul></ul>
  17. 17. C O N F I G U R A T I O N Files <ul><li>server.xml </li></ul><ul><ul><li>The main configuration file. </li></ul></ul><ul><li>web.xml </li></ul><ul><ul><li>Configures servlets and web applications </li></ul></ul><ul><li>tomcat-users.xml </li></ul><ul><ul><li>Roles, users, and passwords </li></ul></ul><ul><li>catalina.bat </li></ul><ul><ul><li>Runtime JVM parameters </li></ul></ul>
  18. 18. References <ul><li>Tomcat Presentation - Harry R. Erwin, PhD, University of Sunderland </li></ul><ul><li>Load balancing Tomcat w/ Apache HTTP Server 2.x w/ mod_proxy </li></ul><ul><li>Professional Apache Tomcat 5 – Vivek Chopra, Amit Bakore, Jon Eaves, Ben Galbraith, Sing Li, Chanoch Wiggers </li></ul><ul><li>Wikipedia </li></ul>