• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat randomly invalidating sessions

 
Bryan Perino
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am having some trouble with my tomcat application. It randomly removes sessions and forces the user to log back in again. This only happens when the app is run with other applications on the same server. If I run it with a fresh Tomcat install with nothing else, it seems to run fine. I am using Tomcat 7.0.42 with JVM 1.7.0_07-b11 and on Windows Server 2008 R2. Any help is much appreciated.

I cross posted this on Stack Overflow.
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are all your root paths the same ? ie. Are all your application's files under one parent directory ?

This symptom can be caused by the browser not sending the session cookie when it has to load two different context root paths for different files ( .htm under one context and .jpeg under another context path ).


This is especially poignant since it works well with only the app loaded and nothing else.
 
Bryan Perino
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each application is under a different path. I created a HttpSessionListener that is never triggered. This application only has 2 jsp files. The front end is done in AngularJS, so I don't know if there is a way to trigger session generation with that. The backend is Hibernate and Spring. I did notice a cookie mistmatch when the error happens



Edit:

There is however a lot of cross path communication between my app, which has two paths.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the Tomcat manager show that the context has been deployed as a single web app?
 
Bryan Perino
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that the app is a single context, /rdk. However, it talks to RDKServer which is a separate one.



/rdk is the AngularJS app which talks to the RDKServer which handles all the data transactions and doesn't have any session associates with it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So all of your session woes are within the /rdk context?
 
Bryan Perino
Greenhorn
Posts: 5
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I actually think that I solved it. The issue had to do with persisting the sessions on disk. For some strange reason, it wasn't working and kept killing them. I had to change the following in context.xml from this



to this



Everything seems fine now. Thank you for the help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting back with your findings!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic