Hi All.

Have been looking for a few days now for a fix for this one issue that I
just cannot get around..

Basically

If I run
http://www.greenlightproductions.co.uk/servlets/SessionExample

The session ID keeps changing  if you refresh the page

(same goes for all other servlet code I been using you login once logged in
session info lost as in new session ID assigned)


but if I go  to port 8180 it works perfect
http://www.greenlightproductions.co.uk:8180/servlets/SessionExample

the session ID remains the same no matter how much i refresh.


I have been looking all over google for an answer for this and most of it is
to do with load balancing tomcat and getting same session ID :(

I am sure others have hit this issue before and it must be a tom cat config
issue (well for the apache listener)

here is some of my config.

#######################################################################
/etc/apache2/mods-enabled/jk2.load
LoadModule jk2_module /usr/lib/apache2/modules/mod_jk2.so

#######################################################################
/etc/apache2/mods-enabled/jk2.conf
# To enable mod_jk2, customize workers2.properties* from
# /usr/share/doc/libapache2-mod-jk2/examples and copy it to
# /etc/apache2/workers2.properties. Then uncomment the following line:
JkSet config.file /etc/apache2/workers2.properties
# Where to put jk logs
#JkLogFile     /var/log/apache2/mod_jk.log

# Set the jk log level [debug/error/info]
#JkLogLevel    info

# Select the log format
#JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# JkOptions indicate to send SSL KEY SIZE,
#JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
#JkRequestLogFormat     "%w %V %T"

# Globally deny access to the WEB-INF directory
<LocationMatch '.*WEB-INF.*'>
       AllowOverride None
       deny from all
</LocationMatch>

#######################################################################
/etc/apache2/workers2.properties
#
# This is the minimal JK2 connector configuration file.
#

[logger]
info=Native logger
level=ERROR

[config:]
file=${serverRoot}/workers2.properties
debug=0
debugEnv=0

[uriMap:]
info=Maps the requests.
debug=0

[shm:]
info=Scoreboard. Required for reconfiguration and status with multiprocess
servers
file=anonymous
debug=0

[workerEnv:]
info=Global server options
timing=0
debug=0

[lb:lb]
info=Default load balancer.
debug=0

[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
debug=0
#tomcatId=tomcat1
tomcatId=localhost:8009
keepalive=1

[uri:/admin]
info=Tomcat HTML based administration web application.
debug=0

[uri:/manager]
info=A scriptable management web application for the Tomcat Web Server.
debug=0

[uri:/jsp-examples]
info=JSP 2.0 Examples.
debug=0

[uri:/servlets-examples]
tomcatId = jvmRoute
info=Servlet 2.4 Examples.
debug=0

[uri:/*.jsp]
info=JSP Extension mapping.
debug=0

[uri:/servlets/*]
worker=ajp13:localhost:8009

#######################################################################
snippets of /etc/tomcat5/server.xml
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!--apache listne added-->
 <Listener className="org.apache.jk.config.ApacheConfig"
  modJk="/usr/lib/apache2/modules/mod_jk2.so"
  WorkersConfig="/etc/apache2/workers2.properties" />

<Listener className="org.apache.jk.config.ApacheConfig"
 append="true" forwardAll="false"
modJk="/usr/lib/apache2/modules/mod_jk2.so"
WorkersConfig="/etc/apache2/workers2.properties" />


...............
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8180 -->
    <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
               port="8180" minProcessors="5" maxProcessors="75"
               enableLookups="true" acceptCount="10" debug="0"
               connectionTimeout="20000" useURIValidationHack="false" />
...
<Host name="www.greenlightproductions.co.uk" debug="0"
appBase="/xxxx/servlets/"
        unpackWARs="true" autoDeploy="true">
       <Context path="/servlets"  docBase="greenlight" debug="0"
reloadable="true"/>

    <Manager   className="org.apache.catalina.session.PersistentManager"
debug="0" saveOnRestart="true" maxActiveSessions="30"
 minIdleSwap="60" maxIdleSwap="60" maxIdleBackup="60">
  <Store className="org.apache.catalina.session.FileStore"
                            directory="/xxx/xxxx/log/"/>
<!--<Store className="org.apache.catalina.session.JDBCStore" driverName="
org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/tomcat?user=nnnn&amp;password=xxxxx"
sessionTable="tomcat$sessions" sessionIdCol="id" sessionDataCol="data"
sessionValidCol="valid" sessionMaxInactiveCol="maxinact
ive" sessionLastAccessedCol="lastaccess" checkInterval="60" debug="99" />
-->
</Manager>
       <parameter>
       <name>driverClassName</name>
       <value>org.gjt.mm.mysql.Driver</value>
    </parameter>
      <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"  prefix="greenlight_log." suffix=".txt" pa
ttern="common" resolveHosts="true"/>
      </Host>




#######################################################################

Reply via email to