Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > BOOK: Professional Apache Tomcat
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 11th, 2004, 05:09 PM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Configuring Apache + Tomcat using mod_jk2

Hi

Currently I have apache (ver :2.0.52) + tomcat (ver : 5.0.28) working properly as a independent instance in win2k environment. Note that I cannot browse to http://localhost/jsp-examples but I can on http://localhost:8080/jsp-examples. I have the mod_jk.dll installed in modules directory and the necessary changes to worker2.properties, http.conf & jk2 properties as per Apache Tomcat5 book chapter 12.
I would appreciate if someone could help me get the proper configuration to get apache to talk to tomcat...

Thank you


 
Old October 15th, 2004, 07:44 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi gnseg!

What does your URI mapping look like in workers2.properties?
In the book there are two different mappings. One looking like this: "[uri:/jsp-examples/*.jsp]" and one looking like this: "[uri:/jsp-examples/*]". If you want http://localhost/jsp-examples to work then the URI mapping should look like this: "[uri:/jsp-examples/*]".

/Phosphora


 
Old November 23rd, 2004, 06:10 PM
Registered User
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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:
  • 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:
HTTP Status 404
HTTP Status 404 - /corpapps/main.jsp

type Status report

message /corpapps/main.jsp

description The requested resource (/corpapps/main.jsp) is not available.


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>





Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_jk2 error in apache logs psimoneschi Apache Tomcat 0 September 12th, 2007 12:11 PM
Problem in configuring tomcat and apache jbashir Servlets 1 October 9th, 2006 08:28 PM
configuring apache Gaurab Classic ASP Databases 0 September 28th, 2005 12:58 PM
Configuring apache? dreadzz BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 4 August 19th, 2005 09:29 AM
Clustering Apache 2 & Tomcat 5 with mod_jk2 blaufenberg BOOK: Professional Apache Tomcat 0 November 23rd, 2004 06:23 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.