aspose file tools
The moose likes Servlets and the fly likes session time out in application after specific time Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "session time out in application after specific time" Watch "session time out in application after specific time" New topic
Author

session time out in application after specific time

Nilesh Sah
Greenhorn

Joined: Jun 17, 2005
Posts: 28
Hi all,
In my application there is a need to end the sessions after specific time since with the increment of the sessions the server(WebLogic 8.1)is getting affected.So i tried by placing certain entries in my web.xml file of that application but sessions are not ending after that specified time even there has been no action done for that long time.

The entry i have made is this
------------------
<session-config>
<session-timeout>10</session-timeout>
</session-config>
-------------------
I have checked the code where at no other place it has been done.
Please suggest whether it is overlapping somewhere else or what i need to do more..
I cannot afford to do that in code since I have to make changes at many places.

Thanks in advance
Nilesh
Rodrigo Alvarez
Ranch Hand

Joined: Apr 10, 2006
Posts: 75
<session-timeout>10</session-timeout>


did you wait 10 minutes ?

The only other place I know where you wan set this timeout is the HttpSession itself:



(in seconds)


It is a mistake to think you can solve any major problems just with potatoes.<br />--Douglas Adams
Nilesh Sah
Greenhorn

Joined: Jun 17, 2005
Posts: 28
Hi Simon ,
Thanks for response.Yes I waited for 10 minute and still it is not working.Please suggest do I need to set something else in xml file.

Thanks a Lot
Nilesh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56212
    
  13

What do you mean by "not working"? That's not a very helpful description.

What is happening versus what is it that you expect to happen? Be explicit.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Nilesh Sah
Greenhorn

Joined: Jun 17, 2005
Posts: 28
Hi Bear,
By saying this I meant the session should expire and not allow to take the request forward after 10 min but in my case even after 10 minute It is allowing that user to use the application.

Thanks
Nilesh Sah
Jass Singh
Ranch Hand

Joined: Mar 30, 2006
Posts: 52
Originally posted by Simon Alvarez:


(in seconds)


This works fine. Just after login/pwd varification set session time using above statement. To make it configurable you can read value from property file as well.

Regards,
Jass
Ganesh Chinni
Greenhorn

Joined: Dec 30, 2005
Posts: 24
Hi Nilesh Sah,

Did you restart the server after changing the web.xml?
And where is the <session-config> element placed in the web.xml?


Also, are you checking if the session is null before processing the request?

Before processing the request, check if session is null, the session will be null if it has timed out(or invalidated). If session is null then do what you need to do if the session is invalid. I mean process the request only if the session is not NULL.


Regards,
Ganesh
SCJP 1.4
SCWCD 1.4
SCBCD 1.3
Nilesh Sah
Greenhorn

Joined: Jun 17, 2005
Posts: 28
Hi Ganesh,
I did restart the server after making modification in web.xml file.Is there any specific place i need to place session-config in web.xml.I am still wondering why it is not affecting the application

Thanks
Nilesh Sah
Nilesh Sah
Greenhorn

Joined: Jun 17, 2005
Posts: 28
Hi Ganesh,
I did restart the server after making modification in web.xml file.Is there any specific place i need to place session-config in web.xml.I am still wondering why it is not affecting the application

Thanks
Nilesh Sah
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026

Is there any specific place i need to place session-config in web.xml.


NO. It has to be under <web-app>


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Nilesh Sah
Greenhorn

Joined: Jun 17, 2005
Posts: 28
Hi Vishnu,
I have placed it under <web-app>.

Thanks
Nilesh
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: session time out in application after specific time
 
Similar Threads
Session Query
how to use session?
What if no "session-config" element?
Session timeout not working
How to set session-Timeout for a App deployed on JBoss 4.3 EAP