Hi All,

I set the jk logging level to debug and noticed that the jsp page was
trying to get an image from from tomcat that didnt exist. This lead
the jk mod to set both tomcat workers to an error state. Im guessing
that the next request I tried got sent to a tomcat and then a new
session was created.

I have fixed the link and now it all works ok.

From the log file...

[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): received from
ajp13 pos=0 len=117 max=8192
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0000    04 01
94 00 2C 2F 72 65 73 32 2E 32 2F 63 6F 6D  - ....,/res2.2/com
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0010    6D 6F
6E 2F 77 65 62 2F 69 6D 61 67 65 73 2F 62  - mon/web/images/b
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0020    6F 78
5F 68 65 6C 70 5F 62 6C 5F 5F 74 2E 70 6E  - ox_help_bl__t.pn
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0030    67 00
00 02 00 0C 43 6F 6E 74 65 6E 74 2D 54 79  - g.....Content-Ty
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0040    70 65
00 00 17 74 65 78 74 2F 68 74 6D 6C 3B 63  - pe...text/html;c
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0050    68 61
72 73 65 74 3D 75 74 66 2D 38 00 00 0E 43  - harset=utf-8...C
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0060    6F 6E
74 65 6E 74 2D 4C 65 6E 67 74 68 00 00 04  - ontent-Length...
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0070    31 30
38 34 00 00 00 00 00 00 00 00 00 00 00 00  - 1084............
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (603): status = 404
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (610): Number of headers is =
2
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (666): Header[0]
[Content-Type] = [text/html;charset=utf-8]
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (666): Header[1]
[Content-Length] = [1084]
[Mon Jun 18 12:29:46 2007] [25142:8064] [info]
ajp_service::jk_ajp_common.c (1876): (jcpres1) request failed, because
of response status 404, recoverable operation attempt=1
[Mon Jun 18 12:29:46 2007] [25142:8064] [info]
ajp_service::jk_ajp_common.c (1941): (jcpres1) sending request to
tomcat failed,  recoverable operation attempt=2
[Mon Jun 18 12:29:46 2007] [25142:8064] [error]
ajp_service::jk_ajp_common.c (1953): (jcpres1) Connecting to tomcat
failed. Tomcat is probably not started or is listening on the wrong
port
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
ajp_done::jk_ajp_common.c (2286): recycling connection pool slot=0 for
worker jcpres1
[Mon Jun 18 12:29:46 2007] [25142:8064] [info]
service::jk_lb_worker.c (1098): service failed, worker jcpres1 is in
error state
[Mon Jun 18 12:29:46 2007] [25142:8064] [debug]
service::jk_lb_worker.c (1111): recoverable error... will try to
recover on other worker
[Mon Jun 18 12:29:46 2007] [25142:8064] [info]
service::jk_lb_worker.c (1160): All tomcat instances are busy or in
error state
[Mon Jun 18 12:29:46 2007] preslb www.jcheck.com 0.023274
[Mon Jun 18 12:29:46 2007] [25142:8064] [info]  jk_handler::mod_jk.c
(2254): Service error=0 for worker=preslb
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): received from
ajp13 pos=0 len=123 max=8192
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0000    04 01
94 00 32 2F 72 65 73 32 2E 32 2F 63 6F 6D  - ....2/res2.2/com
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0010    6D 6F
6E 2F 77 65 62 2F 69 6D 61 67 65 73 2F 62  - mon/web/images/b
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0020    6F 78
5F 68 65 6C 70 5F 63 6C 6F 73 65 5F 62 72  - ox_help_close_br
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0030    5F 5F
74 2E 70 6E 67 00 00 02 00 0C 43 6F 6E 74  - __t.png.....Cont
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0040    65 6E
74 2D 54 79 70 65 00 00 17 74 65 78 74 2F  - ent-Type...text/
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0050    68 74
6D 6C 3B 63 68 61 72 73 65 74 3D 75 74 66  - html;charset=utf
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0060    2D 38
00 00 0E 43 6F 6E 74 65 6E 74 2D 4C 65 6E  - -8...Content-Len
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_connection_tcp_get_message::jk_ajp_common.c (1043): 0070    67 74
68 00 00 04 31 31 30 32 00 00 00 00 00 00  - gth...1102......
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (603): status = 404
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (610): Number of headers is =
2
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (666): Header[0]
[Content-Type] = [text/html;charset=utf-8]
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_unmarshal_response::jk_ajp_common.c (666): Header[1]
[Content-Length] = [1102]
[Mon Jun 18 12:29:46 2007] [25137:8064] [info]
ajp_service::jk_ajp_common.c (1876): (jcpres1) request failed, because
of response status 404, recoverable operation attempt=1
[Mon Jun 18 12:29:46 2007] [25137:8064] [info]
ajp_service::jk_ajp_common.c (1941): (jcpres1) sending request to
tomcat failed,  recoverable operation attempt=2
[Mon Jun 18 12:29:46 2007] [25137:8064] [error]
ajp_service::jk_ajp_common.c (1953): (jcpres1) Connecting to tomcat
failed. Tomcat is probably not started or is listening on the wrong
port
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
ajp_done::jk_ajp_common.c (2286): recycling connection pool slot=0 for
worker jcpres1
[Mon Jun 18 12:29:46 2007] [25137:8064] [info]
service::jk_lb_worker.c (1098): service failed, worker jcpres1 is in
error state
[Mon Jun 18 12:29:46 2007] [25137:8064] [debug]
service::jk_lb_worker.c (1111): recoverable error... will try to
recover on other worker
[Mon Jun 18 12:29:46 2007] [25137:8064] [info]
service::jk_lb_worker.c (1160): All tomcat instances are busy or in
error state




On 6/18/07, ben short <[EMAIL PROTECTED]> wrote:
Hi All,

I'm trying to setup session clustering between two Tomcat 6.0.13
instances with Apache 2.2 and Mod JK 1.2.23.

The problem I'm having is that every request returns me a new session
so the users state is not kept, So i assume that the clustering is not
configured correctly.

Looking at the manager app on both tomcats i see the same number of
sessions, so they seem tobe replicated between the server.

Can anyone help me out please.


Here is my server.xml from tomcat 1

<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at
/docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">

    <!-- Define an HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
            address="192.168.6.174"
            backlog="20"
            connectionTimeout="0"
            maxThreads="100"
            tcpNoDelay="true" />

    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jcpres1">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">


        <Valve className="org.apache.catalina.valves.AccessLogValve" 
directory="logs"
               prefix="access." suffix=".log" pattern="common"
resolveHosts="false"/>


        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                channelSendOptions="4">

                <Manager className="org.apache.catalina.ha.session.DeltaManager"
                        expireSessionsOnShutdown="false"
                        notifyListenersOnReplication="true"/>

                <Channel 
className="org.apache.catalina.tribes.group.GroupChannel">

                        <Membership
className="org.apache.catalina.tribes.membership.McastService"
                                address="228.0.0.4"
                                port="26816"
                                frequency="500"
                                dropTime="3000"/>

                        <Receiver 
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                                address="192.168.6.174"
                                port="4000"
                                autoBind="100"
                                selectorTimeout="5000"
                                maxThreads="6"/>

                        <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
                                <Transport 
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"
                                        timeout="3000"/>
                        </Sender>

                        <Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>

                        <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>

                </Channel>

                <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
                        
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>

                <Valve 
className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

                <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
                <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>

        </Cluster>

      </Host>
    </Engine>
  </Service>
</Server>


Tomcat 2's server.xml

<Server port="8005" shutdown="SHUTDOWN">

  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <!--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html -->
  <Listener className="org.apache.catalina.core.JasperListener" />
  <!-- JMX Support for the Tomcat server. Documentation at
/docs/non-existent.html -->
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener 
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">

    <!-- Define an HTTP/1.1 Connector on port 8080 -->
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
            address="192.168.6.174"
            backlog="20"
            connectionTimeout="0"
            maxThreads="100"
            tcpNoDelay="true" />

    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jcpres2">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">


        <Valve className="org.apache.catalina.valves.AccessLogValve" 
directory="logs"
               prefix="access." suffix=".log" pattern="common"
resolveHosts="false"/>


        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                channelSendOptions="4">

                <Manager className="org.apache.catalina.ha.session.DeltaManager"
                        expireSessionsOnShutdown="false"
                        notifyListenersOnReplication="true"/>

                <Channel 
className="org.apache.catalina.tribes.group.GroupChannel">

                        <Membership
className="org.apache.catalina.tribes.membership.McastService"
                                address="228.0.0.4"
                                port="26816"
                                frequency="500"
                                dropTime="3000"/>

                        <Receiver 
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                                address="192.168.6.174"
                                port="4000"
                                autoBind="100"
                                selectorTimeout="5000"
                                maxThreads="6"/>

                        <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
                                <Transport 
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"
                                        timeout="3000"/>
                        </Sender>

                        <Interceptor
className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>

                        <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>

                </Channel>

                <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
                        
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>

                <Valve 
className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

                <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
                <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>

        </Cluster>

      </Host>
    </Engine>
  </Service>
</Server>

And my workers.properties..


# For full details abotu configuration options please visit
# http://tomcat.apache.org/connectors-doc/reference/workers.html

# JK Status worker config

worker.list=jkstatus
worker.jkstatus.type=status

# Presentaton Load Balancer Config

worker.list=preslb

worker.preslb.type=lb
worker.preslb.balance_workers=jcpres1,jcpres2
worker.preslb.sticky_session=1

worker.jcpres1.port=8009
worker.jcpres1.host=192.168.6.174
worker.jcpres1.type=ajp13
worker.jcpres1.lbfactor=1
worker.jcpres1.fail_on_status=404,503

worker.jcpres2.port=8009
worker.jcpres2.host=192.168.6.171
worker.jcpres2.type=ajp13
worker.jcpres2.lbfactor=1
worker.jcpres2.fail_on_status=404,503

# Core Load Balancer Config

worker.list=corelb

worker.corelb.type=lb
worker.corelb.balance_workers=worker3
worker.corelb.sticky_session=0

worker.worker3.port=8010
worker.worker3.host=192.168.6.103
worker.worker3.type=ajp13
worker.worker3.lbfactor=1
worker.worker3.fail_on_status=404,503


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to