This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Issues in Session persistance: Apache Tomacat 5.5_16 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Issues in Session persistance: Apache Tomacat 5.5_16" Watch "Issues in Session persistance: Apache Tomacat 5.5_16" New topic
Author

Issues in Session persistance: Apache Tomacat 5.5_16

birenshah shahbiren
Greenhorn

Joined: Feb 28, 2008
Posts: 19
Hi,

I have been trying to test Load balancing & Clustering with Tomcat5.5_16
Configured one LoadBalancer and three Cluster nodes.
Load balancer & cluster is working fine. I am facing a problem of session state persistence.

server.xml of Load balancer contains below tag:
<Manager className="org.apache.catalina.session.PersistentReplicationManager" debug="0" saveOnRestart="true">
<Store className="org.apache.catalina.session.FileStore" directory="D:\Software\JARFiles\Session"/>
</Manager>

There are no session info is getting stored at the directory location.

Thanks for help.
Biren

birenshah shahbiren
Greenhorn

Joined: Feb 28, 2008
Posts: 19
On the close observation, I found PersistentReplicationManager does not exist.
I replaced it with PersistentManager, as shown below:

<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" expireSessionsOnShutdown="false" managerClassName="org.apache.catalina.cluster.session.PersistentReplicationManager" useDirtyFlag="true">

<Manager className="org.apache.catalina.session.PersistentManager" maxActiveSessions="-1" maxIdleBackup="0" maxIdleSwap="0" minIdleSwap="0">
<Store className="org.apache.catalina.session.FileStore" directory="C:/Apache Software Foundation/Tomcat 5.5/temp"/>
</Manager>
</Cluster>

Now the problem is managerClassName="org.apache.catalina.cluster.session.PersistentReplicationManager" also does not exist. If I remove this line, still the session info is not stored in file.

I am pasting server.xml

<?xml version="1.0" encoding="UTF-8"?>

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

<Listener className="org.apache.catalina.core.AprLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

<!-- Global JNDI resources -->
<GlobalNamingResources>

<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>

<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>

</GlobalNamingResources>

<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">

<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" enableLookups="false" maxHttpHeaderSize="8192" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="8080" redirectPort="8443"/>

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector enableLookups="false" port="8009" protocol="AJP/1.3" redirectPort="8443"/>

<!-- Define the top level container in our container hierarchy -->
<Engine defaultHost="localhost" jvmRoute="LoadBalancer" name="Catalina">

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


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


<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster" expireSessionsOnShutdown="false" managerClassName="org.apache.catalina.cluster.session.PersistentReplicationManager" useDirtyFlag="true">

<Manager className="org.apache.catalina.session.PersistentManager" maxActiveSessions="-1" maxIdleBackup="0" maxIdleSwap="0" minIdleSwap="0">
<Store className="org.apache.catalina.session.FileStore" directory="C:/Apache Software Foundation/Tomcat 5.5/temp"/>
</Manager>

<Membership className="org.apache.catalina.cluster.mcast.McastService" mcastAddr="228.0.0.4" mcastBindAddress="127.0.0.1" mcastClusterDomain="d10" mcastDropTime="30000" mcastFrequency="500" mcastPort="45564"/>

<Receiver className="org.apache.catalina.cluster.tcp.ReplicationListener" tcpListenAddress="127.0.0.1" tcpListenPort="4000" tcpSelectorTimeout="100" tcpThreadCount="6"/>

<Sender className="org.apache.catalina.cluster.tcp.ReplicationTransmitter" replicationMode="pooled"/>

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

</Cluster>



<Context docBase="balancer" path="/balancer" reloadable="true" source="org.eclipse.jst.j2ee.server:balancer"/></Host>

</Engine>

</Service>

</Server>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Issues in Session persistance: Apache Tomacat 5.5_16