Hi,
If someone would be kind enough to take a look at this - I'd really appreciate it - as my brain can't take much more abuse and frustration.
I have been able to connect Apache and one Tomcat worker together successfully...and now I am ready to move onto a load balanced environment using File-based session backup.
I've been following the example setup described in the book...(and have tried various suggestions found in googleland), but I seem to keep running into the same issue...
Environment:
- Windows 2000
- JDK 1.4.2_05
- Apache 2.0.49
- mod_jk2 2.0.49
- Tomcat 5.0.28
When I startup the Tomcat instances, they seem to establish the clustered environment okay...but when Apache starts up, the errors below spit out and whenever I try to access a JSP page, I get the following browser error:
Code:
HTTP Status 404 - /corpapps/main.jsp
type Status report
message /corpapps/main.jsp
description The requested resource (/corpapps/main.jsp) is not available.
Apache Tomcat/5.0.28
Apache Error Log
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done logger.apache2
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done config
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done shm
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done channel.socket:localhost:8009
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done ajp13:localhost:8009
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done channel.socket:localhost:8010
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done ajp13:localhost:8010
[Tue Nov 23 14:20:57 2004] [notice] config.setAttribute() Error setting lb:corpappscluster timeout 90
[Tue Nov 23 14:20:57 2004] [notice] config.setAttribute() Error setting lb:corpappscluster attempts 3
[Tue Nov 23 14:20:57 2004] [notice] config.setAttribute() Error setting lb:corpappscluster recovery 30
[Tue Nov 23 14:20:57 2004] [notice] config.setAttribute() Error setting lb:corpappscluster stickySession 1
[Tue Nov 23 14:20:57 2004] [notice] config.setAttribute() Error setting lb:corpappscluster noWorkersMsg Server busy please retry later
[Tue Nov 23 14:20:57 2004] [notice] config.setAttribute() Error setting lb:corpappscluster noWorkerCodeMsg 503
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done lb:corpappscluster
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done uri:/corpapps/*
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done status:
[Tue Nov 23 14:20:57 2004] [notice] config.update(): done uri:/jkstatus/*
[Tue Nov 23 14:20:57 2004] [notice] shm.create() Created head 5e0008 size 8192
Here are my config files (I'm running on Win2K):
Snippets from httpd.conf
Code:
# Module for load balancing Tomcat clusters
LoadModule jk2_module modules/mod_jk2.so
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot D:/Data/Websites/corpapps
ServerName corpapps
ServerAlias corpapps
ErrorLog logs/corpapps-error
CustomLog logs/corpapps-access_log common
Options +Includes
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</VirtualHost>
workers2.properties
Code:
# ------------------------------------------------------------------
# Set a logger
# ------------------------------------------------------------------
[logger.apache2]
file=D:/Apache2/logs/error.log
level=INFO
debug=1
# ------------------------------------------------------------------
# Config settings
# ------------------------------------------------------------------
[config]
file=conf/workers2.properties
debug=0
# ------------------------------------------------------------------
# Shared memory file settings
# ------------------------------------------------------------------
[shm]
file=D:/Data/WebApplications/etexap1/apps/corpapps-cluster/apache-shm/jk2.shm
size=100000
# ------------------------------------------------------------------
# Communication channel settings for logical server "machine1"
# ------------------------------------------------------------------
[channel.socket:localhost:8009]
host=localhost
port=8009
tomcatId=machine1
group=corpappscluster
lb_factor=1
route=machine1route
# Declare a tomcat worker for logical server "machine1"
[ajp13:localhost:8009]
channel=channel.socket:machine1
# ------------------------------------------------------------------
# Communication channel settings for logical server "machine2"
# ------------------------------------------------------------------
[channel.socket:localhost:8010]
host=localhost
port=8010
tomcatId=machine2
group=corpappscluster
lb_factor=1
route=machine2route
# Declare a tomcat worker for logical server "machine2"
[ajp13:localhost:8010]
channel=channel.socket:machine2
# ------------------------------------------------------------------
# Load balancer for Corporate Applications
# ------------------------------------------------------------------
[lb:corpappscluster]
worker=ajp13:localhost:8009
worker=ajp13:localhost:8010
timeout=90
attempts=3
recovery=30
stickySession=1
noWorkersMsg=Server busy please retry later
noWorkerCodeMsg=503
# ------------------------------------------------------------------
# Map the tomcat "corpapps" webapp to the web server uri space
# ------------------------------------------------------------------
[uri:/corpapps/*]
info=mapping the corpapps context of tomcat
group=corpappscluster
context=/corpapps
# ------------------------------------------------------------------
# Setup a status worker to report Tomcat server performance metrics
# ------------------------------------------------------------------
[status:]
[uri:/jkstatus/*]
group=status
jk2.properties
Code:
channelSocket.port=8010
channelSocket.address=localhost
shm.file=D:/Data/WebApplications/etexap1/apps/corpapps-cluster/apache-shm/jk2.shm
server.xml (I'm only including one...but trust that the ports for server and connector elements reflect what is in workers2.properties)
Code:
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8009" protocol="AJP/1.3"/>
<Engine name="Catalina" defaultHost="localhost" debug="0" jvmRoute="machine1route">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<Context docBase="corpapps" path="/corpapps">
<Manager className="org.apache.catalina.session.PersistentManager"
maxIdleBackup="5"
maxIdleSwap="5"
checkInterval="5">
<Store className="org.apache.catalina.session.FileStore"
directory="D:/Data/WebApplications/etexap1/apps/corpapps-cluster/sharedir"/>
</Manager>
</Context>
</Host>
</Engine>
</Service>
</Server>
web.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>
Corporate Applications
</description>
<display-name>
Corporate Applications
</display-name>
<distributable/>
<session-config>
<session-timeout>300</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>