Hello all,
        What exactly i need is the transfer of the session values held in
the tomcat1's session to tomcat2, in the event of the tomact1's crash or
shutdown.
The object that is retrieving values from session is 'Serialized' as
specified in the tomcat documentation for clustering
The scenario that i am trying is
1. Start Apache HTTP server
2. Start Tomcat 1
3. Start Tomcat 2
4. Access the application through the web browser
5. Log in to the application
    a. The application log is showing all the session values created
    b. mod_jk.log is also showing that the application is loadbalenced and
responses are coming properly as
[Thu Jul 17 10:18:21 2008] [10116:0001] [info]  mod_jk.c (2744):
mod_jk/1.2.23 initialized
[Thu Jul 17 10:18:21 2008] [10117:0001] [info]  mod_jk.c (2744):
mod_jk/1.2.23 initialized
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.250889
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.008006
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.014582
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.020901
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.005226
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.015901
[Thu Jul 17 10:21:13 2008] balancer 172.16.17.184 0.022453
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.893808
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.035366
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.040783
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.050546
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.021703
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.017510
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.014542
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.016893
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.014258
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.019373
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.022091
[Thu Jul 17 10:22:44 2008] balancer 172.16.17.184 0.015848
[Thu Jul 17 10:22:45 2008] balancer 172.16.17.184 0.017921
[Thu Jul 17 10:22:45 2008] balancer 172.16.17.184 0.018734
[Thu Jul 17 10:22:45 2008] balancer 172.16.17.184 0.014850

6. Shutdown Tomcat 1 (Actually the tomcat that is creating the session is
shutdown and here i am asuming it as Tomcat 1 for example)
7. Click a link in the application running on the browser.
8. Application Log showing that new session is created for Tomcat 2
[][10:24:13][][][New Session creates with id
---->E38C8B4FD547033B05BDD8FC31E6C939.node02]
9. Application Log showing session values are null
10. mod_jk.log file showing the following trace
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1215):
(node01) error sending request. Will try another pooled connection
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1215):
(node01) error sending request. Will try another pooled connection
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1241):
(node01) all endpoints are disconnected
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1244):
(node01) increase the backend idle connection timeout or the
connection_pool_minsize
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1941):
(node01) sending request to tomcat failed,  recoverable operation attempt=1
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_connect.c (451): connect
to 172.16.17.184:8009 failed (errno=239)
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (876):
Failed opening socket to (172.16.17.184:8009) (errno=239)
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1273):
(node01) error connecting to the backend server (errno=239)
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_ajp_common.c (1941):
(node01) sending request to tomcat failed,  recoverable operation attempt=2
[Thu Jul 17 10:24:12 2008] [10119:0006] [error] jk_ajp_common.c (1953):
(node01) Connecting to tomcat failed. Tomcat is probably not started or is
listening on the wrong port
[Thu Jul 17 10:24:12 2008] [10119:0006] [info]  jk_lb_worker.c (1098):
service failed, worker node01 is in error state
[Thu Jul 17 10:24:13 2008] balancer 172.16.17.184 0.311893
[Thu Jul 17 10:24:13 2008] balancer 172.16.17.184 0.028857
[Thu Jul 17 10:24:16 2008] balancer 172.16.17.184 0.012416
[Thu Jul 17 10:24:16 2008] balancer 172.16.17.184 0.041042
[Thu Jul 17 10:24:16 2008] balancer 172.16.17.184 0.049775

*Here are the configuration*

OS: HP-UNIX
Apache Version: 2.x (don't know 'x', it was already installed)
Tomcat Version: 6.0.14 (Both tomcat's and Apache server are running on the
same machine)
Browser: Firefox 3.0

I am using the Apache HTTP server for load balancing and the script i added
to the httpd.conf file is this

#APACHE TOMCAT 6.0.14 Configurations
<IfModule !mod_jk.c>
LoadModule jk_module modules/mod_jk.so
</IfModule>

JkWorkersFile conf/workers3.properties
JkLogFile     logs/mod_jk.log
JkLogLevel    info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkRequestLogFormat "%w %V %T"
JkMount /jkstatus jkstatus

#LBTEST ROOT
JkMount / balancer
JkMount /* balancer

             The workers3.properties file contains the following contents

workers.java_home=/opt/java6
ps=/

worker.list=node01,node02,balancer

worker.node01.type=ajp13
worker.node01.host=<System IP>
worker.node01.port=8009
worker.node01.lbfactor=1

worker.node02.type=ajp13
worker.node02.host=<System IP>
worker.node02.port=8010
worker.node02.lbfactor=1

##################### Load Balance #####################
worker.balancer.type=lb
worker.balancer.method=B
worker.balancer.sticky_session=True
worker.balancer.balance_workers=node01,node02

             Configured Tomcat's server.xml as given in the tomcat
documentation

*Tomcat 1's Server.xml*

<?xml version='1.0' encoding='utf-8'?>
  <Server port="8007" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
  <Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase" description=" "
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

   <Service name="Catalina">
<!-- <Connector port="8082" 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"/>
<!-- <Engine name="Standalone" defaultHost="localhost" /> -->

     <Engine name="Catalina" defaultHost="localhost" jvmRoute="node01" >
     <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
     <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="45564"
         frequency="500"
         dropTime="3000"/>
     <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
        address="auto"
        port="4001"
        autoBind="100"
        selectorTimeout="5000"
        maxThreads="6"/>

    <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
    <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
    </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=""/>
    <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
    <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
       tempDir="/tmp/war-temp/"
       deployDir="/tmp/war-deploy/"
       watchDir="/tmp/war-listen/"
       watchEnabled="false"/>
    <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
    <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>

<!-- <Valve className="org.apache.catalina.valves.RequestDumperValve"/> -->
    <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.authenticator.SingleSignOn" />
-->
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/> -->


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


*Tomcat 2's server.xml
*<?xml version='1.0' encoding='utf-8'?>
  <Server port="8006" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <GlobalNamingResources>
  <Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase" description=" "
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <Service name="Catalina">
<!-- <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000"
redirectPort="8443" /> -->
<!-- Define an AJP 1.3 Connector on port 8009 -->
     <Connector port="8010" protocol="AJP/1.3" redirectPort="8443" />
<!-- <Engine name="Standalone" defaultHost="localhost" /> -->

     <Engine name="Catalina" defaultHost="localhost" jvmRoute="node02" >
     <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="8">
     <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="45564"
         frequency="500"
         dropTime="3000"/>
     <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
        address="auto"
        port="4001"
        autoBind="100"
        selectorTimeout="5000"
        maxThreads="6"/>

    <Sender
className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
    <Transport
className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
    </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=""/>
    <Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
    <Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
       tempDir="/tmp/war-temp/"
       deployDir="/tmp/war-deploy/"
       watchDir="/tmp/war-listen/"
       watchEnabled="false"/>
    <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
    <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
    </Cluster>

<!-- <Valve className="org.apache.catalina.valves.RequestDumperValve"/> -->
    <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.authenticator.SingleSignOn" />
-->
<!-- <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/> -->
      </Host>
    </Engine>
  </Service>
</Server>

Help me to know where i am going wrong.
Thank you.

*
*

Reply via email to