Configuring Tomcat-4.x
Configuring Tomcat-4.x

IMPORTANT: This is for xpetstore-servlet ONLY

  1. Set TOMCAT_HOME
    Make sure that the variable TOMCAT_HOME is set to the Tomcat home directory
  2. Configure Tomcat - Copy the JDBC driver to TOMCAT_HOME/common/lib
    - Edit TOMCAT_HOME/conf/server.xml and make sure that it looks like this:
    
    <Server port="8005" shutdown="SHUTDOWN" debug="0">
      ...
      <Service name="Tomcat-Standalone">
        ...
        <Engine name="Standalone" defaultHost="localhost" debug="0">
    
          <Logger className="org.apache.catalina.logger.FileLogger"
                  prefix="catalina_log." suffix=".txt"
                  timestamp="true"/>
    
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase"/>
    
          <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" liveDeploy="true">
            ...
            <!-- xPetstore -->
            <Context path="/xpetstore-servlet" docBase="xpetstore-servlet" 
                  debug="0"   reloadable="true" crossContext="true">
              <!-- xPetsore Logger -->
              <Logger className="org.apache.catalina.logger.FileLogger" 
                 directory="logs"  
                 prefix="xpetstore-servlet_log." 
                 suffix=".txt" 
                 timestamp="true"
              />
    
              <!-- xPetstore datasource -->
              <Resource name="jdbc/xpetstoreDS" auth="Container" type="javax.sql.DataSource"/>		 
              <ResourceParams name="jdbc/xpetstoreDS">
                <parameter> 
                  <name>factory</name>
                  <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                </parameter>            
                <parameter>
                  <name>username</name>
                  <value>your-db-user</value>
                </parameter>
                <parameter>
                  <name>password</name>
                  <value>your-db-password</value>
                </parameter>
                <parameter>
                  <name>driverClassName</name>
                  <value>your-db-driver</value>
                </parameter>
                <parameter>
                  <name>url</name>
                  <value>your-db-url</value>
                </parameter>
              </ResourceParams>
    
              <!-- xPetstore mail session -->
              <Resource name="mail/xpetstore/MailSession" 
                  auth="Container" type="javax.mail.Session"/>
              <ResourceParams name="mail/xpetstore/MailSession">
                <parameter>
                  <name>mail.smtp.host</name>
                  <value>your-mail-host</value>
                </parameter>
              </ResourceParams>
            </Context>
            ...
          </Host>
      </Engine>
      </Service>
    </Server>