Tomcat Setup

This describes setting up Tomcat WebServletFramework.



Enable Tomcat application management and administration web interfaces by modifying tomcat-users.xml in /var/lib/tomcat5.5/conf/:

<?xml version='1.0' encoding='utf-8'?>
  <role rolename="tomcat"/>
  <role rolename="manager"/>
  <role rolename="admin"/>
  <user username="$USER" password="$PASSWORD" roles="admin,manager,tomcat"/>

Here, $USER and $PASSWORD should be substituted with a name and password to be presented to Tomcat.

The Ubuntu Tomcat package listens for HTTP requests on port 8180,

The "Status", "Tomcat Administration" and "Tomcat Manager" links in the top left corner will require the above user name and password.


The tomcat5.5 package in Ubuntu as well as Debian requires some fiddling to pre-process ("compile") JSP pages into Java code. The following symptoms indicate bad packaging:

  • Error:
Missing taglibs (JSTL).
  • Cause: JSTL jars need to be downloaded from Jakarta Taglibs web site and copied to the endorsed Tomcat directory.

  • Error:
no jsp servlet
  • Cause: jasper-compiler.jar is missing from /usr/share/tomcat5.5/commons/endorsed/, along with many other JARs found in ../lib/.

  • Error:
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(
        at org.apache.commons.logging.LogFactory.getLog(
        at org.apache.catalina.startup.Bootstrap.<clinit>(
Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(
        ... 4 more
Caused by: java.lang.NullPointerException
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
        ... 5 more
  • Cause: A recent (1.1) version of Commons Logging is required, not the one packaged with libcommons-logging-java (1.0.4).

The Adjustments

cd ~/download
tar xvzf commons-logging-1.1-src.tar.gz
cd /usr/share/tomcat5.5/common/endorsed/
# Use the Commons Logging v. 1.1 rather than the packaged 1.0.4.
# Otherwise the above null pointer exception in getLogConstructor will occur.
sudo cp -a ~/download/commons-logging-1.1/commons-logging-1.1.jar .

# Set the factory to Jdk14Logger so that web apps compiled against JCL could 
# channel their output through java.util.logging.  Add this to JAVA_OPTS in 
# /etc/default/tomcat5.5:


# Download the JSTL JARs from Jakarta Taglibs,
#(jstl.jar and standard.jar), copy them to 
# /usr/local/share/java/.  (I do not know why these JARs are not packaged by
# Debian).

# Download the "JDK compatibility" JARs from Apache Tomcat and copy 
# xml-apis.jar to /usr/local/share/java/.

sudo apt-get install libxalan2-java
for f in \
         commons-collections3.jar commons-dbcp.jar commons-el.jar \
         commons-pool.jar jasper-compiler.jar jasper-compiler-jdt.jar \
         jasper-runtime.jar \
         jsp-api.jar  servlet-api.jar \
         naming-factory.jar naming-resources.jar \
         serializer.jar xalan2.jar xercesImpl.jar \
   ; do
   sudo rm $f
   sudo ln -s /usr/share/java/$f .
for f in \
         jstl.jar standard.jar xml-apis.jar \
   ; do
   sudo rm $f
   sudo ln -s /usr/local/share/java/$f .


The cluster setup does not involve a J2EE application server.

1. Tomcat FAQ. Cluster.

Other articles explain the internals and management of Tomcat clusters.

2. Session Replication in Tomcat 5 Clusters, Part 2, by Srini Penchikala, 12/15/2004.

3. Clustering and Load Balancing in Tomcat 5, Part 2, by Srini Penchikala, 04/14/2004. 4. Remotely monitor Tomcat clusters using MC4J, By Srini Penchikala,, 08/01/05. -- IlguizLatypov - 10 Jul 2007
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r5 - 2013-08-16 - DrewPilcher
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback