apache tomcat web server

26
Apache Tomcat Apache Tomcat Web Server Web Server MOHD NORFAIZI MIHSANY MOHD NORFAIZI MIHSANY (A91391) (A91391)

Upload: karim

Post on 25-Feb-2016

70 views

Category:

Documents


7 download

DESCRIPTION

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 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Apache Tomcat  Web Server

Apache Tomcat Apache Tomcat Web ServerWeb ServerMOHD NORFAIZI MIHSANY MOHD NORFAIZI MIHSANY

(A91391)(A91391)

Page 2: Apache Tomcat  Web Server

Web ServerWeb Server

Used application server locate Used application server locate at technician room.at technician room.

202.185.47.240202.185.47.240

Page 3: Apache Tomcat  Web Server

ArchitectureArchitecture

Page 4: Apache Tomcat  Web Server

Server Setup Step by StepServer Setup Step by Step

Download and install the Java Download and install the Java Software Development Kit Software Development Kit (SDK).(SDK).

Download ServerDownload Server Configure the ServerConfigure the Server Set up Development Set up Development

EnvironmentEnvironment TestTest

Page 5: Apache Tomcat  Web Server

Download and Install Java Download and Install Java Software Development Kit (SDK)Software Development Kit (SDK)

http://java.sun.com/j2se/1.4.2/http://java.sun.com/j2se/1.4.2/index.jspindex.jsp

Download the setup.Download the setup. Install the SDK.Install the SDK.

Page 6: Apache Tomcat  Web Server

Download a ServerDownload a Server

Apache Tomcat, Macromedia JRun, Apache Tomcat, Macromedia JRun, Jetty, Microsoft IIS, iPlanet/Sun ONE Jetty, Microsoft IIS, iPlanet/Sun ONE Server and Apache Server.Server and Apache Server.

Apache Tomcat 4.0 Apache Tomcat 4.0 ((http://jakarta.apache.org/tomcathttp://jakarta.apache.org/tomcat) ) was used for this project.was used for this project.

Apache Tomcat 4.0 is the official Apache Tomcat 4.0 is the official reference implementation for Servlet reference implementation for Servlet 2.3 and JSP 1.2.2.3 and JSP 1.2.

It’s entirely free and has complete It’s entirely free and has complete source code available.source code available.

Page 7: Apache Tomcat  Web Server

Configuring Apache TomcatConfiguring Apache Tomcat

Setting the JAVA_HOME variable.Setting the JAVA_HOME variable. Specifying the server port.Specifying the server port. Enabling servlet reloading.Enabling servlet reloading. Enabling the ROOT context.Enabling the ROOT context. Turning on the invoker servlet.Turning on the invoker servlet. Increasing DOS memory limits (older Increasing DOS memory limits (older

windows).windows). Setting CATALINA_HOME Setting CATALINA_HOME

(optional).(optional).

Page 8: Apache Tomcat  Web Server

Setting the JAVA_HOME Setting the JAVA_HOME VariableVariable Right click My Computer.Right click My Computer. Select Properties.Select Properties. Select Advance.Select Advance. Select Environment Variable.Select Environment Variable. Add JAVA_HOME value and click Add JAVA_HOME value and click

OK.OK. Another way by edit Another way by edit

install_dir/bin/catalina.batinstall_dir/bin/catalina.bat and insert and insert this line this line

set JAVA_HOME=C:\J2sdk1.4.0set JAVA_HOME=C:\J2sdk1.4.0

Page 9: Apache Tomcat  Web Server
Page 10: Apache Tomcat  Web Server
Page 11: Apache Tomcat  Web Server

Specifying the Server PortSpecifying the Server Port

By default, Apache Tomcat used By default, Apache Tomcat used port 8080.port 8080.

Modifying the port number Modifying the port number involves editing involves editing install_dir/conf/server.xml.install_dir/conf/server.xml.

Page 12: Apache Tomcat  Web Server

The original element will look something like this :The original element will look something like this :

<Connector className=“org.apache.coyote.tomcat4.CoyoteConnector”<Connector className=“org.apache.coyote.tomcat4.CoyoteConnector”port=“8080”port=“8080” minProcessors=“5” maxProcessors=“75” minProcessors=“5” maxProcessors=“75”……. />. />

AfterAfter

<Connector className=“org.apache.coyote.tomcat4.CoyoteConnector”<Connector className=“org.apache.coyote.tomcat4.CoyoteConnector”port=“80”port=“80” minProcessors=“5” maxProcessors=“75” minProcessors=“5” maxProcessors=“75”……. />. />

Page 13: Apache Tomcat  Web Server

Enabling Servlet ReloadingEnabling Servlet Reloading

To turn on servlet reloading, edit To turn on servlet reloading, edit install_dir/conf/server.xml.install_dir/conf/server.xml.

Find Find <!-- Define properties for each web application. …<!-- Define properties for each web application. …

……. -->. -->

Insert following line just below itInsert following line just below it<DefaultContext reloadable=“true” /><DefaultContext reloadable=“true” />

Page 14: Apache Tomcat  Web Server

Enabling the ROOT ContextEnabling the ROOT Context

Edit Edit install_dir/conf/server.xml.install_dir/conf/server.xml. Uncomment the following lineUncomment the following line

<Context path=“” docBase=“ROOT” debug=“0” /><Context path=“” docBase=“ROOT” debug=“0” />

Page 15: Apache Tomcat  Web Server

Turning On the Invoker Turning On the Invoker ServletServlet Edit Edit install_dir/conf/web.xml.install_dir/conf/web.xml. Uncomment following lineUncomment following line

<servlet-mapping><servlet-mapping>

<servlet-name>invoker</servlet-name><servlet-name>invoker</servlet-name><url-pattern>/servlet/*</url-pattern><url-pattern>/servlet/*</url-pattern>

</servlet-mapping></servlet-mapping>

Page 16: Apache Tomcat  Web Server

Increasing DOS Memory Increasing DOS Memory LimitsLimits For old version of Windows like For old version of Windows like

windows 98.windows 98. Right click Right click

install_dir/bin/startup.batinstall_dir/bin/startup.bat.. Select properties.Select properties. Select memory and change the Select memory and change the

Initial Environment from Auto to Initial Environment from Auto to at least 2816.at least 2816.

Page 17: Apache Tomcat  Web Server

Setting CATALINA_HOMESetting CATALINA_HOME

Right click My Computer.Right click My Computer. Select Properties.Select Properties. Select Advance.Select Advance. Select Environment Variable.Select Environment Variable. Add CATALINA_HOME value Add CATALINA_HOME value

and click OK.and click OK.

Page 18: Apache Tomcat  Web Server

Test your SetupTest your Setup

Double click on Double click on install_dir/bin/startup.bat.install_dir/bin/startup.bat.

Open browser and enterOpen browser and enterHttp://localhostHttp://localhost

Page 19: Apache Tomcat  Web Server
Page 20: Apache Tomcat  Web Server

Using The Default Web Using The Default Web ApplicationApplication Packageless ServletPackageless Servlet

code : code : install_dir/webapps/ROOT/WEB-INF/classesinstall_dir/webapps/ROOT/WEB-INF/classesURLURL : : http://host:port/servlet/ServletNamehttp://host:port/servlet/ServletName

Packaged ServletPackaged Servletcodecode : : install_dir/webapps/ROOT/WEB-INF/ install_dir/webapps/ROOT/WEB-INF/ classes/packagenameclasses/packagenameURLURL : : http://host:port/servlet/packageName.ServletNamehttp://host:port/servlet/packageName.ServletName

Page 21: Apache Tomcat  Web Server

Using The Default Web Using The Default Web ApplicationApplication Packaged Beans and Utility Packaged Beans and Utility

ClassesClassesinstall_dir/webapps/ROOT/WEB-INF/ install_dir/webapps/ROOT/WEB-INF/ classes/packageNameclasses/packageName

JAR FilesJAR Filesinstall_dir/install_dir/webapps/ROOT/WEB-INF/libwebapps/ROOT/WEB-INF/lib

Page 22: Apache Tomcat  Web Server

Using The Default Web Using The Default Web ApplicationApplication HTML and JSP (Not In HTML and JSP (Not In

Subdirectories)Subdirectories)codecode : : install_dir/webapps/ROOTinstall_dir/webapps/ROOT

URLURL : : http://host:port/filenamehttp://host:port/filename

HTML and JSP (In HTML and JSP (In Subdirectories)Subdirectories)codecode : : install_dir/webapps/ROOT/directoryNameinstall_dir/webapps/ROOT/directoryName

URLURL : : http://host:port/directoryNme/filenamehttp://host:port/directoryNme/filename

Page 23: Apache Tomcat  Web Server

Servlet and JSP APIsServlet and JSP APIs

Install_dir/webapps/tomcat-Install_dir/webapps/tomcat-docs/servletapi/index.htmldocs/servletapi/index.html

Page 24: Apache Tomcat  Web Server

CLASSPATHCLASSPATH

Set CLASSPATH in Set CLASSPATH in Environment Variable.Environment Variable.

Have it include Have it include installdir/common/lib/servlet.jar.installdir/common/lib/servlet.jar.

For compile Servlet application.For compile Servlet application.

Page 25: Apache Tomcat  Web Server

TracerouteTraceroute

http://mips.myloca.com/tracehttp://mips.myloca.com/trace

Page 26: Apache Tomcat  Web Server

ReferenceReference

Marty Hall, Larry Brown. 2004. Marty Hall, Larry Brown. 2004. Core Servlets and JavaServer Core Servlets and JavaServer Pages.Pages. Second Edition. U.S.A: Second Edition. U.S.A: Prentice Hall.Prentice Hall.

Marty Hall. 2005. Apache Marty Hall. 2005. Apache Tomcat Tutorial.Tomcat Tutorial. (online) (online) http://www.coreservlets.com/Aphttp://www.coreservlets.com/Apache-Tomcat-Tutorial (10 March ache-Tomcat-Tutorial (10 March 2005)2005)