January 8, 2007

Installing and Configuring Apache Tomcat web server

Step 1: download Java from Sun Java’ site and install Java and set the JAVA_HOME and PATH Variables properly by opening a DOS window and typing "java -version" and "javac -help". You should see a real result both times, not an error message about an unknown command.
  1. Select My Computer Icon on your Desktop, do right click and select the properties option.
  2. Select Advanced Tab and select Environment Variables, In the System Variables > Click New Button and Enter your JAVA_HOME=Path of the installed java on your machine Ex: c:\jdk 1.5 and Save it.
  3. Go to PATH in the System Variables, edit it and add PATH Variable PATH=*;C:\Jdk 1.5\bin;
  4. Open the Dos Prompt and type java –version [Enter], you will see the following output

O/P: java version "1.5.0_01"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)

Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
&
Javac

O/P: Usage: javac

where possible options include:

-g Generate all debugging info

-g:none Generate no debugging info

-g:{lines,vars,source} Generate only some debugging info

-nowarn Generate no warnings

-verbose Output messages about what the compiler is doing

-deprecation Output source locations where deprecated APIs are used

-classpath Specify where to find user class files

-cp Specify where to find user class files

-sourcepath Specify where to find input source files

-bootclasspath Override location of bootstrap class files

-extdirs Override location of installed extensions

-endorseddirs Override location of endorsed standards path

-d Specify where to place generated class files

-encoding Specify character encoding used by source files

-source Provide source compatibility with specified release

-target Generate class files for specific VM version

-version Version information

-help Print a synopsis of standard options

-X Print a synopsis of nonstandard options

-J Pass directly to the runtime system

Step 2:

  1. Go to http://jakarta.apache.org/builds and download and unpack the zip file for the latest version (4.1.24 or 5.0 as of last revision of this page).
  2. Start the Startup.bat from the tomcat installed or unzipped directory.

Jan 9, 2007 2:59:10 AM org.apache.coyote.http11.Http11Protocol init

INFO: Initializing Coyote HTTP/1.1 on http-8080

Jan 9, 2007 2:59:10 AM org.apache.catalina.startup.Catalina load

INFO: Initialization processed in 2140 ms

Jan 9, 2007 2:59:10 AM org.apache.catalina.core.StandardService start

INFO: Starting service Catalina

Jan 9, 2007 2:59:10 AM org.apache.catalina.core.StandardEngine start

INFO: Starting Servlet Engine: Apache Tomcat/5.0.30

Jan 9, 2007 2:59:10 AM org.apache.catalina.core.StandardHost start

INFO: XML validation disabled

Jan 9, 2007 2:59:10 AM org.apache.catalina.core.StandardHost getDeployer

INFO: Create Host deployer for direct deployment ( non-jmx )

Jan 9, 2007 2:59:10 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Processing Context configuration file URL file:C:\Program Files\Apache Sof

tware Foundation\Tomcat 5.0\conf\Catalina\localhost\admin.xml

Jan 9, 2007 2:59:14 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Processing Context configuration file URL file:C:\Program Files\Apache Sof

tware Foundation\Tomcat 5.0\conf\Catalina\localhost\balancer.xml

Jan 9, 2007 2:59:15 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Processing Context configuration file URL file:C:\Program Files\Apache Sof

tware Foundation\Tomcat 5.0\conf\Catalina\localhost\manager.xml

Jan 9, 2007 2:59:16 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Installing web application at context path /jsp-examples from URL file:C:\

Program Files\Apache Software Foundation\Tomcat 5.0\webapps\jsp-examples

Jan 9, 2007 2:59:17 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Installing web application at context path from URL file:C:\Program Files

\Apache Software Foundation\Tomcat 5.0\webapps\ROOT

Jan 9, 2007 2:59:17 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Installing web application at context path /servlets-examples from URL fil

e:C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\servlets-exampl

es

Jan 9, 2007 2:59:17 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Installing web application at context path /tomcat-docs from URL file:C:\P

rogram Files\Apache Software Foundation\Tomcat 5.0\webapps\tomcat-docs

Jan 9, 2007 2:59:17 AM org.apache.catalina.core.StandardHostDeployer install

INFO: Installing web application at context path /webdav from URL file:C:\Progra

m Files\Apache Software Foundation\Tomcat 5.0\webapps\webdav

Jan 9, 2007 2:59:17 AM org.apache.coyote.http11.Http11Protocol start

INFO: Starting Coyote HTTP/1.1 on http-8080

Jan 9, 2007 2:59:17 AM org.apache.jk.common.ChannelSocket init

INFO: JK2: ajp13 listening on /0.0.0.0:8009

Jan 9, 2007 2:59:17 AM org.apache.jk.server.JkMain start

INFO: Jk running ID=0 time=15/31 config=C:\Program Files\Apache Software Founda

tion\Tomcat 5.0\conf\jk2.properties

Jan 9, 2007 2:59:17 AM org.apache.catalina.startup.Catalina start

INFO: Server startup in 7672 ms

  1. Change the DOS memory settings. If you get an "Out of Environment Space" error message when you start the server, right-click on install_dir/bin/startup.bat, select Properties, select Memory, and change the Initial Environment entry from Auto to at least 2816. Repeat the process for install_dir/bin/shutdown.bat.
  2. Set the CATALINA_HOME variable. Optionally, set CATALINA_HOME to refer to the top-level Tomcat installation directory.

Set the CATALINA_HOME environment variable to refer to the top-level directory of the Apache Tomcat installation (e.g., C:\tomcat 5.0). This variable identifies the Tomcat installation directory to the server.

If you want to change the Port from 80 to 8080 just add the following steps

To change the port, edit install_dir/conf/server.xml and change the port attribute of the Connector element from 8080 to 80, yielding the result below. (Note that the exact class name of the Connector varies in different Tomcat versions. It was called HttpConnector in earlier versions of Tomcat 4.)

Connector

className="org.apache.coyote.tomcat4.CoyoteConnector"

port="80" ...

Enter the Following URL http://localhost:8080(port)/index.jsp in your web browser, Tomcat home page will be displayed.

No comments: