Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Struts - A MVC web framework
Tomcat - JSP/Servlet container
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
JSP - A mailing list about Java Server Pages specification and reference
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
keeping same session via apache2 mod_jk2 and tomcat5

keeping same session via apache2 mod_jk2 and tomcat5

2006-03-17       - By Vahid Hedayati

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

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 Source code of 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 Source code of 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 Source code of org.apache.catalina.session.PersistentManager"
debug="0" saveOnRestart="true" maxActiveSessions="30"
minIdleSwap="60" maxIdleSwap="60" maxIdleBackup="60">
 <Store className="org.apache.catalina.session.FileStore Source code of org.apache.catalina.session.FileStore"
                           directory="/xxx/xxxx/log/"/>
<!--<Store className="org.apache.catalina.session.JDBCStore Source code of org.apache.catalina.session.JDBCStore" driverName="
org.gjt.mm.mysql.Driver Source code of 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 Source code of org.gjt.mm.mysql.Driver</value>
   </parameter>
     <Valve className="org.apache.catalina.valves.AccessLogValve Source code of org.apache.catalina.valves.AccessLogValve"
directory="logs"  prefix="greenlight_log." suffix=".txt" pa
ttern="common" resolveHosts="true"/>
     </Host>




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

©2008 junlu.com - Jax Systems, LLC, U.S.A.