tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Janner <>
Subject httpd/Tomcat load balancing question
Date Wed, 22 Dec 2010 19:19:26 GMT
Httpd 2.2.17
Tomcat 6.0.29
Sun JDK 1.6.0_22
Spring Framework (3.0.2 I think)
All on Windows

The Dev team is creating a new app that we are planning to deploy using httpd as a load-balancer
to two Tomcats on separate servers.  Httpd is configured to serve static files - graphics,
css, etc. - with everything else being sent to the Tomcat servers over AJP.  The Tomcat app
has one jsp file setup as the welcome-file, which just does a redirect to host/app/login,
which is an internal action that generates the real login screen.  All other parts of the
app are buried in the WEB-INF/classes structure (as far as I can tell).

We are currently testing the setup, and if you go to, everything
seems to work just fine.  The browser gets redirected to
and the screen looks fine.  The problem is if you go directly to the login page, bypassing
the welcome-file redirect, then you don't get the static files.  If you refresh the page,
everything shows up again.

Looking at the source of the login page, it appears that all the static links have the jsessionid
appended to them on the first load, but not on subsequent loads.  I assume this is because
Tomcat hasn't determined cookie support yet when it generates the page the first time, but
does know about it on the refresh.  My question is, is there something the Dev team should
be doing before generating the login page, or generating the static links, or is there a configuration
setting I'm missing in the httpd.conf file?  Or perhaps in the web.xml?


The httpd.conf file is pretty stock, with the following added for the load-balancer configuration:

<Location /balancer-manager>
  SetHandler balancer-manager

  Order Deny,Allow
  Deny from all
  Allow from 10.1.1

<Proxy balancer://mycluster>
                BalancerMember ajp://prtltest01:8009/Portal route=tomcat1 loadfactor=50
                BalancerMember ajp://prtltest02:8009/Portal route=tomcat2 loadfactor=50

ProxyPass /Portal/static !
ProxyPass /Portal balancer://mycluster stickysession=JSESSIONID|jsessionid scolonpathdelim=On
ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid scolonpathdelim=On

The web.xml file is:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="" xmlns:xsi=""
xsi:schemaLocation="               ">
    <display-name>Polydyne Portal Application</display-name>
    <!-- Log4J Config -->

    <!-- Concurrent Session Control -->

    <!-- Reads request input using UTF-8 encoding -->

    <!-- Spring Security settings start -->
    <!-- Spring Security settings end -->
    <!-- Servlet Definition -->
     - Map static resources to the default servlet
     - examples:
     -     http://localhost:8080/static/images/pets.png
     -     http://localhost:8080/static/styles/petclinic.css

    <!-- Servlet Definition End -->

Confidentiality Notice:  This Transmission (including any attachments) may contain information
that is privileged, confidential, and exempt from disclosure under applicable law.  If the
reader of this message is not the intended recipient you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly prohibited.  

If you have received this transmission in error, please immediately reply to the sender or
telephone (512) 343-9100 and delete this transmission from your system.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message