Tomcat Configuration

From Plex-XML

Jump to: navigation, search

Contents

Tomcat Port

The default port for http servers is 80. Tomcat defaults to using port 8080 instead to avoid an installation of tomcat automatically being seen as a public web server. If you don't have or plan to install any other web server on your PC you could put the Tomcat-Service on port 80 in place of the default port 8080. Then you don't have to put the port after each URL.

You can change tomcat's default port by editing the conf/server.xml file. Look for the following Connector definition near the top of the file:

 <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
  <Connector port="8080" maxHttpHeaderSize="8192"
   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
   enableLookups="false" redirectPort="8443" acceptCount="100"
   connectionTimeout="20000" disableUploadTimeout="true" />

Log-Files

There are different log files in your Tomcat-Logs directory that could give some useful informations about problems or errors in your implementation.

  • stdout.log
  • stderr.log
  • admin.log

You should check these files if you application won't act as expected.

Using Tomcat with different server names

In order to have Tomcat available with another name than the original server name the following steps have to be taken:

  1. Map the new server name in your DNS server
  2. Enter a new host entry into your server.xml file in your Tomcat instance. For example: <Host name="finance.toepfer.net" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"/>
  3. Create a new folder inside your conf\Catalina folder with the name of the server. For example finance.toepfer.net
    1. Put the applications context.xml file into the new folder. For example Finance.xml
    2. If the application should run in the root directory of the new server tha path attribute in the context node has to be empty. For example <Context docBase="Financial" path="" reloadable="false" privileged="false" debug="0">


Der Pfad im docBase-Attribut ist relativ zum appBase-Verzeichnis in Schritt 2 angelegten Host-Nodes in der server.xml. Wahlweise kann auch ein absoluter Pfad angegeben werden.

Java.lang.OutOfMemoryError: PermGen space

This error may occur when the JVM runs out of space in the permanent generation heap.


If the application(s) in the server use a large number of classes, the solution is to increase the value specified with -XX:MaxPermSize.

Try to use -XX:MaxPermSize=256m in the Java options of your Tomcat.

Using UTF-8 within URLs

when using UTF-8 (recommended) you should enable Tomcat to decode such URLs. To do so, you should add an attribute 'URIEncoding="UTF8"' to the <Connector ...>-Element(s) in your server.xml

Links to other Tomcat configuration pages

Configuration of Context.xml

Personal tools