Tomcat configuration

Please note that this is only a brief description of the most common tasks you may have to perform to run some of our software, and may not reflect changes in the most recent Tomcat versions.
For the most up-to-date information on Tomcat configuration please also visit the project's web site .

1. Defining a web application

There are two ways to define a web application in Tomcat: by editing the configuration file, or by using the interactive Administration Tool.

1.1 Manually editing the configuration file

1.2 Using the administration tool

  1. Enter the Administration Tool of Tomcat at http://localhost:8080/admin
  2. Enter username and password: (default: admin, admin)
  3. Select Tomcat Server >> Service >> Host in the tree component.
  4. Select Create New Context in the Available Actions list box.
  5. Set Document Base and Path (e.g.: c:\jchem, /jchem)
  6. Click Save and Commit Changes
  7. Collapse and expand the Host node to check the new subnode: Context (/jchem)
  8. Restart Tomcat

2. Jar files / classpath

Tomcat has designated directories for jar files. All jar files in these directories are automatically included into the server's classpath (at Tomcat startup).
NOTE: Tomcat never uses the system CLASSPATH.
Copy all files from <JChem home>/lib/ and the jar or zip file(s) containing the JDBC driver of your choosed database (and all other custom libraries) into Tomcat's lib subdirectory: Restart Tomcat, so changes can take effect.

Note: Please always update these jar files when upgrading JChem.

3. Java options

3.1 Recommended JVM options

There are two important Java options which should be set for Tomcat.

3.2 Setting JVM options for Tomcat

4. Setting session timeout

In web applications every user is identified by a session. The session holds information about the user. A typical example is an internet shop: the contents of your shopping cart is stored in a session.

To prevent the number of sessions to increase infinitely, they are destroyed after certain time of inactivity (time without changing the page) from the user. This is called session timeout. All user data stored in the session disappears (e.g. you have fill your shopping cart again).

Sometimes the default session timeout may be too low, especially when the user is expected to spend a lot of time on a single page. To increase the timeout value in Tomcat, please locate the following section in [Tomcat_home]/conf/web.xml:

    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
The timeout value is specified in minutes.
Restart Tomcat after modifying the file, so the changes can take effect.

5. Disabling persistence

In newer Tomcat versions (5.5 and above) the persistent storage of the context is enabled by default.

Since not all session objects used by JChem can be stored this way (they are not serializable), this can result in annoying (though harmless) error messages in Tomcat's log during restart..

To disable persistence please edit <Tomcat home>/conf/context.xml, and uncomment the following line (by removing "<!--" from the start and "-->" from the end of the comment):

          <Manager pathname="" />

6. Common pitfalls