530 likes | 1.26k Views
Apache Tomcat Web Server. MOHD NORFAIZI MIHSANY (A91391). Web Server. Used application server locate at technician room. 202.185.47.240. Architecture. Server Setup Step by Step. Download and install the Java Software Development Kit (SDK). Download Server Configure the Server
E N D
Apache Tomcat Web Server MOHD NORFAIZI MIHSANY (A91391)
Web Server • Used application server locate at technician room. • 202.185.47.240
Server Setup Step by Step • Download and install the Java Software Development Kit (SDK). • Download Server • Configure the Server • Set up Development Environment • Test
Download and Install Java Software Development Kit (SDK) • http://java.sun.com/j2se/1.4.2/index.jsp • Download the setup. • Install the SDK.
Download a Server • Apache Tomcat, Macromedia JRun, Jetty, Microsoft IIS, iPlanet/Sun ONE Server and Apache Server. • Apache Tomcat 4.0 (http://jakarta.apache.org/tomcat) was used for this project. • Apache Tomcat 4.0 is the official reference implementation for Servlet 2.3 and JSP 1.2. • It’s entirely free and has complete source code available.
Configuring Apache Tomcat • Setting the JAVA_HOME variable. • Specifying the server port. • Enabling servlet reloading. • Enabling the ROOT context. • Turning on the invoker servlet. • Increasing DOS memory limits (older windows). • Setting CATALINA_HOME (optional).
Setting the JAVA_HOME Variable • Right click My Computer. • Select Properties. • Select Advance. • Select Environment Variable. • Add JAVA_HOME value and click OK. • Another way by edit install_dir/bin/catalina.bat and insert this line set JAVA_HOME=C:\J2sdk1.4.0
Specifying the Server Port • By default, Apache Tomcat used port 8080. • Modifying the port number involves editing install_dir/conf/server.xml.
The original element will look something like this : <Connector className=“org.apache.coyote.tomcat4.CoyoteConnector” port=“8080” minProcessors=“5” maxProcessors=“75” …. /> After <Connector className=“org.apache.coyote.tomcat4.CoyoteConnector” port=“80” minProcessors=“5” maxProcessors=“75” …. />
Enabling Servlet Reloading • To turn on servlet reloading, edit install_dir/conf/server.xml. • Find <!-- Define properties for each web application. … …. --> • Insert following line just below it <DefaultContext reloadable=“true” />
Enabling the ROOT Context • Edit install_dir/conf/server.xml. • Uncomment the following line <Context path=“” docBase=“ROOT” debug=“0” />
Turning On the Invoker Servlet • Edit install_dir/conf/web.xml. • Uncomment following line <servlet-mapping> <servlet-name>invoker</servlet-name> <url-pattern>/servlet/*</url-pattern> </servlet-mapping>
Increasing DOS Memory Limits • For old version of Windows like windows 98. • Right click install_dir/bin/startup.bat. • Select properties. • Select memory and change the Initial Environment from Auto to at least 2816.
Setting CATALINA_HOME • Right click My Computer. • Select Properties. • Select Advance. • Select Environment Variable. • Add CATALINA_HOME value and click OK.
Test your Setup • Double click on install_dir/bin/startup.bat. • Open browser and enter Http://localhost
Using The Default Web Application • Packageless Servlet code : install_dir/webapps/ROOT/WEB-INF/classes URL : http://host:port/servlet/ServletName • Packaged Servlet code : install_dir/webapps/ROOT/WEB-INF/ classes/packagename URL : http://host:port/servlet/packageName.ServletName
Using The Default Web Application • Packaged Beans and Utility Classes install_dir/webapps/ROOT/WEB-INF/ classes/packageName • JAR Files install_dir/webapps/ROOT/WEB-INF/lib
Using The Default Web Application • HTML and JSP (Not In Subdirectories) code : install_dir/webapps/ROOT URL : http://host:port/filename • HTML and JSP (In Subdirectories) code : install_dir/webapps/ROOT/directoryName URL : http://host:port/directoryNme/filename
Servlet and JSP APIs • Install_dir/webapps/tomcat-docs/servletapi/index.html
CLASSPATH • Set CLASSPATH in Environment Variable. • Have it include installdir/common/lib/servlet.jar. • For compile Servlet application.
Traceroute • http://mips.myloca.com/trace
Reference • Marty Hall, Larry Brown. 2004. Core Servlets and JavaServer Pages. Second Edition. U.S.A: Prentice Hall. • Marty Hall. 2005. Apache Tomcat Tutorial.(online) http://www.coreservlets.com/Apache-Tomcat-Tutorial (10 March 2005)