Download presentation
Presentation is loading. Please wait.
1
Tomcat Celsina Bignoli
2
History of Tomcat Tomcat is the result of the integration of two groups of developers. JServ, an open source implementation of the Servlet specification. Sun’s own servlet engine. The focus of the two groups was different: JServ concentrated on performance Sun’s implementation was more concerned with adherence to specification. Sun donated the code to Apache Software Foundation. A group was formed – named Jakarta - that was given a charter of merging the implementations Tomcat was born
3
Tomcat Requirements Strict adherence to Sun’s JSP/Servlet specification Interoperability Modifiability Performance Scalability High-availability Security
4
Architecture
5
Architecture Server: Server represents the entire Tomcat server. One server per JVM. Service: Service component creates the connectors and associates the engine with this group of connectors. Connector: Connectors are components that implement the socket listeners. They connect web applications to clients. This component provides flexibility to the Tomcat architecture. It allows the Tomcat servlet engine to integrate with many different types of web servers such as Apache, IIS etc. Engine: Engine is the top level container. It examines the request and routes the request to the appropriate virtual host. Host: This allows multiple servers to be configured on the same physical machine and be identified by separate IP addresses. Context: This represents a single web application
6
Tomcat Installation and Configuration
Install JDK1.5 Download the Jakarta Tomcat software Set the JAVA_HOME variable Change port from 8080 to 80 (optional) Set the CATALINA_HOME variable
7
Changing port to 80 configure Tomcat to run on the default HTTP port (80) instead of the out-of-the-box port of 8080. Making this change lets you use URLs of the form instead of Some versions of Windows XP automatically start IIS on port 80. So, if you use XP you may need to disable IIS (see the Administrative Tools section of the Control Panel). To change the port, edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80 <Connector port="80" ... maxThreads="150" minSpareThreads="25" ...
8
Setting CATALINA_HOME Variable
set the CATALINA_HOME environment variable to refer to the top-level directory of the Apache Tomcat installation (e.g., C:\jakarta-tomcat ). This variable identifies the Tomcat installation directory to the server.
9
Testing the Server Involves two steps:
Verifying that the server can even start Checking that you can access your own HTML and JSP pages use the default Web application. put HTML and JSP pages in install_dir/webapps/ROOT or install_dir/webapps/ROOT/somePath and access them with or
10
Setting the Development Environment
Define a working directory in which to place the servlets and JSP pages that you develop The development directory should NOT reside in the Tomcat deployment directory
11
Making Shortcuts to Start and Stop the Server
place shortcuts to the server startup and shutdown scripts inside the main development directory or on the desktop. Go to install_dir/bin, right-click on startup.bat, and select Copy. go to your development directory, right-click in the window, and select Paste Shortcut (not just Paste). Repeat the process for install_dir/bin/shutdown.bat.
12
Setting CLASSPATH Since servlets and JSP are not part of the Java 2 platform, standard edition, you have to identify the servlet classes to the compiler. The server already knows about the servlet classes, but the compiler (i.e., javac) you use for development probably doesn't. Include the following jar file in the CLASSPATH install_dir/common/lib/servlet-api.jar install_dir/common/lib/jsp-api.jar Alternatively you can put the above jar files in java_dir/lib/ext
13
Compiling and Testing Simple Servlets
to verify the environment is all set compile and run some simple Servlet, i.e. HelloServlet.java the location for servlets in the default Web application is: install_dir/webapps/ROOT/WEB-INF/classes Once you compile HelloServlet.java, put HelloServlet.class in: After compiling the code, access the servlet with the URL:
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.