Tomcat FAQ

Modified on Tue, Mar 26 at 11:14 AM

Apache Tomcat FAQ

How to hide the Server Version from all error messages generated by Apache Tomcat

In this example, Apache Tomcat is installed in c:\schoolfi-tomcat

Make this directory:  c:\schoolfi-tomcat\lib\org\apache\catalina\util

Create a new text file: ServerInfo.properties

Put this one line of text in the file:

server.info=Generic Web Server

Restart Tomcat

The error message should look like this now:

Garbage 1 Collector in JDK 7u5

Documentation here: Garbage 1 Collector doc in jdk1.70_04

To enable: add this to Tomcat -XX:+UseG1GC

Only use with JVM Heap Sizes of 6 Gig or more

Max Request Parameters Error In catalina.out or genesis.log

The exact error message is:

INFO: More than the maximum number of request parameters (GET plus POST) for a single request ([10,000]) were detected. Any parameters beyond this limit have be en ignored. To change this limit, set the maxParameterCount attribute on the Connector.

In the server.xml, you want to add maxParameterCount="100000" to all Connectors.  For example:

<Connector port="8080" protocol="HTTP/1.1"
  connectionTimeout="20000"
  redirectPort="8443" 
  maxParameterCount="100000" />

On Windows; Tomcat fails to start as a service. No error seems to be reported anywhere.

This usually occurs during a fresh installation of Tomcat. The problem is that the newer versions of Java 1.6 do not include a crucial DLL for the service to start. To fix, perform this task:

  1. Determine where your JDK is installed. It is almost always in c:\jdk1.6.0_07.
  1. Determine where your Tomcat is installed. It is almost always in c:\tomcat.
     Run this command (fill the in the drive and paths with the correct values)
  2. Copy c:\jdk1.6.0_05\bin\msvcrt71.dll c:\tomcat\bin

Server hangs: java.lang.OutOfMemoryError: PermGen space appears in the Tomcat log file.

This log file can usually be found in either c:\tomcat\logs or /usr/tomcat/logs. The server will stop accepting new connections; and this error may appear in the log file.

The Java runtime does not have enough PermGen allocated.

To correct this on Windows: (Tomcat may be on another drive in your installation)

c:\> net stop "Apache Tomcat"
c:\> cd \tomcat\bin
C:\tomcat\bin> tomcat6w

Click on the Java tab; and add this line to the bottom of the text box

-XX:MaxPermSize=384m

To correct this on Linux / Solaris / Mac OS/X: Logon on as root.

# cd /usr/tomcat/bin
# ./shutdown.sh
# vi setenv.sh

Add the -XX:MaxPermSize=384m to your environment string. Your file should look something like this when your done:

CATALINA_OPTS="-Xmx5000m -Xms5000m -server -d64 -XX:MaxPermSize=768m -Djava.awt.headless=true"
CATALINA_PID="/var/run/genesis.pid"

Start Tomcat back up

# nohup ./startup.sh &

How do I configure Tomcat to connect to Oracle RAC?

First, you will need to know the service name of the RAC installation. To find this out; log onto the Oracle server and run this command (any platform)

c:\> lsnrctl status
 
....
 

Edit the /usr/tomcat/conf/Catalina/localhost/instance.xml file.

HTTP Status 403 - The request body was too large to be cached during the authentication process

This error may occur when a user is automatically logged out; and they hit a save button on certain screens with large amounts of content. (Screens like GRadebook, Grade Posting etc...).

When a user is forced to re-logon; Tomcat (The webserver) will cache the data from the page they were on; and then use it after succesfull logon. The default limit of the cached data is 4 kilobytes.

To change this limit; open the server.xml file on your tomcat installation. On Unix operating systems, this file is generally in /usr/tomcat/conf/server.xml. On Windows operating systems this file is generally in c:\tomcat\conf\server.xml.

In the Connector(s) blocks of the server.xml, add the maxSavePostSize parameter; and set it to -1 to allow an unlimited sized post to be cached. Here is an example of that file:

<Server port="8005" shutdown="SHUTDOWN">  
  <Service name="Catalina">
    <Connector port="80" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100" 
               connectionTimeout="20000" disableUploadTimeout="true"
               maxSavePostSize="-1"     />
 <Engine name="Catalina" defaultHost="localhost">
          <Host name="localhost" appBase="webapps" unpackWARs="false" autoDeploy="false"
                xmlValidation="false" xmlNamespaceAware="false"/>
        
    </Engine>
  </Service>
</Server>

Restart Tomcat to have this go into effect.

Autostarting Tomcat on Redhat Linux

Create the file /etc/init.d/genesis

#!/bin/sh
# chkconfig: 345 99 10
# description: Genesis Autostart Script
#
 
case "$1" in
    'start')
        # Start genesis
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - -c "nohup /usr/tomcat/bin/startup.sh &"
        ;;
    'stop')
        # Stop the Oracle databases:
        # The following command assumes that the oracle login
        # will not prompt the user for any values
        su - -c "/usr/tomcat/bin/shutdown.sh"
        ;;
esac

Run these commands:

# chmod 775 /etc/init.d/genesis
# ln -s /etc/init.d/genesis /etc/rc.d/rc0.d/K01genesis
# ln -s /etc/init.d/genesis /etc/rc.d/rc3.d/S99genesis
# ln -s /etc/init.d/genesis /etc/rc.d/rc5.d/S99genesis
# chkconfig --level 345 genesis on

Page that redirects to another site

If you are site is going to be hosted on the ASP in case of an emergency; the following
 login.jsp could be used (/usr/tomcat/webapps/district/login.jsp)

<%@ page import="com.genesis.sis.CommonValidations"%>
<%@ page import="com.genesis.sis.beans.AuditSecurity"%>
<%@ page import="com.genesis.sis.beans.GenesisSystem" %>
<%@ page import="com.genesis.sis.SystemInfo" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String test = request.getServerName().toLowerCase();
    if (test.contains("parents"))
        response.sendRedirect("http://parents.genesisedu.com/district");
    else
        response.sendRedirect("http://genesis.genesisedu.com/district");
%>

Upgraded to Tomcat 8 and servers startup fails on Windows with the following exception

SEVERE [main] org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["http-nio-443"]
java.net.MalformedURLException: unknown protocol: c

A simple configuration change in the server.xml is required:

The problem is the keystoreFile attribute on the Connector element.   Tomcat 8 requires that on Windows servers backslashes be used instead of forward slashed.

<Connector port="443" 
               enableLookups="false" 
               connectionTimeout="20000" scheme="https"
               sslProtocol="TLS" secure="true" SSLEnabled="true"
               keystoreFile="c:/genesis/ssl/genesis.jks"
               keystorePass="sch00lisc00l"
               keystoreType="JKS" />

 

Change c:/genesis/ssl/genesis.jks to c:\\genesis\\ssl\\genesis.jks

Be sure to use double backslashes for the path separators.

 

Is your district using Cisco DUO / OAuth 2.0 for authentication?

The following Tomcat - genesis.xml parameter is not compatible with OAuth 2.0

<CookieProcessor sameSiteCookies="strict" /> 


 

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article