Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > BOOK: Professional Apache Tomcat
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Apache Tomcat
This is the forum to discuss the Wrox book Professional Apache Tomcat by Chanoch Wiggers, Ben Galbraith, Vivek Chopra, Sing Li, Debashish Bhattacharjee, Amit Bakore, Romin Irani, Sandip Bhattacharya, Chad Fowler; ISBN: 9780764543722
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 23rd, 2004, 06:23 PM
Registered User
 
Join Date: Nov 2004
Location: Chicago, IL, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Clustering Apache 2 & Tomcat 5 with mod_jk2

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 admin@email.com
    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>
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache tomcat load clustering problem abcprocure Apache Tomcat 0 May 30th, 2008 06:04 AM
Clustering in Tomcat 6.0 praveenasri BOOK: Professional Apache Tomcat 0 February 27th, 2008 09:52 AM
mod_jk2 error in apache logs psimoneschi Apache Tomcat 0 September 12th, 2007 12:11 PM
JWS Axis Tomcat (posted to Apache Tomcat too) rushman Servlets 0 April 15th, 2005 09:32 AM
Configuring Apache + Tomcat using mod_jk2 gnseg BOOK: Professional Apache Tomcat 2 November 23rd, 2004 06:10 PM



All times are GMT -4. The time now is 09:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.