• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

does session remain alive even if i shuts down the server in tomcat?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i started the server and hit the url for myfile so a new session got created.
now i shut down the server (not the browser).
and started it again .and refreshed the page.
then in this case will i get new session id or the same id will be continued (which was assigned to me at first time) in tomcat?
 
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
unless you have save your state in some secondary storage...server will start a new session.

cheers!!
Neeraj.
 
Santosh Jagtap
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Neeraj Vij:
unless you have save your state in some secondary storage...server will start a new session.

cheers!!
Neeraj.



yeah thts true if i haven't persisted my session object i wont get the same object but its happening
what i did is
i created 3 jsp pages
1 - containing 2 buttons one for setsession attr and another for getsession attr
2 - for sesetting session attribute by name "myName" value is "Santy"
3 - for getting and printing session attribute "myName"

i hitted the url for the first jsp and clicked on set session button the second file get called and the attribute is stored in session by name myname with value "Santy"
then i pressed back button and clicked on get button ,the third file get called and printed "Santy"
then again i clicked on back button

now i restarted the server refreshed the first jsp and called directly third file .even then i got the output as "Santy"
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

humm...

Just for my help..

1.)before restarting the server clear the browser history and delete all temp. internet files which contains cookies too.
2.)then try to get the seesion variable value.


rgds,
Neeraj.
 
Santosh Jagtap
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Neeraj Vij:
Hi,

humm...

Just for my help..

1.)before restarting the server clear the browser history and delete all temp. internet files which contains cookies too.
2.)then try to get the seesion variable value.


rgds,
Neeraj.



Hi
I tried tht still it prints the value.But onething is it happens only with tomcat i tried on oc4j it printed null.
 
Neeraj Vij
Ranch Hand
Posts: 315
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



try it by clearing the temp. work area directory of tomcat.

rgds,
Neeraj.
 
Santosh Jagtap
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah i tried tht also still it is coming...
i think tomcat must be persisting each session...
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Servlet engines are allowed to serialize sessions out to disk - thats why it is a good idea to make sure all objects "stored" in sessions are Serializable. Take a look at your server.xml file in Tomcat for references to persistent sessions.
Bill
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic