Tomcat Instructions

This document describes the various aspects of Tomcat Administration. The following are the instructions for iusing the tomcat web server

1  Basics

1)  Download and install a JDK (could be part of a J2EE installation like SUN ONE)

2)  Set the java home in the bin\setclasspath.bat file

Set JAVA_HOME=C:\Program Files\Sun\AppServer\jdk

3)  Start the server by double clicking bin\startup.bat

4)  Stop by double clicking bin\shutdown.bat

5  Add a admin role and a manager role in the conf\tomcat-users.xml

<role rolename="manager"/>

<role rolename="admin"/>

<user username="manager" password="tomcat"
roles="manager"/>

<user username="admin" password="tomcat"
roles="admin"/>

6)  Now you can do tomcat admin using

http://localhost:8080/admin/frameset.jsp

7)  And you can login into tomcat web application
manager (to manage all the web apps)

http://localhost:8080/manager/html

8)  These two hyper links are actually present in the home

http://localhost:8080/

2  Create a New Web App
2.1  Create a Data Source

1)  Add the following to ../WEB-INF/web.xml

<resource-ref>

<description>DB Connection</description>

<res-ref-name>jdbc/simplepmDS</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

2)  Create a context.xml file in META-INF folder with the following information

<?xml version="1.0" encoding="UTF-8"?>

<Context

<crossContext="true"

reloadable="true">

<Resource

auth="Container"

name="jdbc/sampleDS"

type="javax.sql.DataSource"

password="pass"

driverClassName="com.mysql.jdbc.Driver"

maxIdle="30"

maxWait="10000"

username="user"

url="jdbc:mysql://localhost:3306/sample?autoReconnect=true"

maxActive="100"/>

</Context>

3)  Copy the mysql-connector-java-3.1.0-alpha-bin.jar into the ….\common\lib folder, so that it is visible to both the web applications and the server

3  Install Struts

1)  Deploy the struts-example.war into Tomcat using step 7 (section 2.1)

2)  Deploy the struts-documentation.war into Tomcat

3)  Copy one of the web apps and rename it (for example struts-validator)

4)  Then modify the index.jsp, XXX.jsp

5)  Modify struts-config.xml, ApplicationResources.properties

4  Debugging

1)  Set the DEGUB_OPTS variable in the Catalina.bat

Set DEBUG_OPTS=-server -Xdebug -Xnoagent -Djava.compiler=NONE Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000