Hi David,
Thanks for reply but I guess I need something else. All answers to
your suggested situation are negative. Answers included in your
message.
--- David Wall <[EMAIL PROTECTED]> wrote:
> Is it possible that your session has ended (too long between
> requests)?
nope, another servlet get session with no problem. and after few
minutes servlet is null problem just works fine.
> Check how long you have configured sessions to be active (in
> web.xml). Is
> it possible you are losing the encoded session ids (if cookies are
> not being
> used)? It's easy to miss an encoded URL on a page for get/post and
> thus lose
> the session id on the next request. Then again, I've seen bugs
> before in
> which cookies are quite reliable, but encoded URLs don't always
> seem to
> work.
I do encode URL just in case, but Cookie is used on client
side(browser). When I look at the source page URL is not encoded.
>
> David
>
Any other ideas?
> ----- Original Message -----
> From: "Mark" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, October 12, 2004 8:36 AM
> Subject: request.getSession(false) randomly returns null in servlet
>
>
> > Hi All,
> > I have unstable behavior in my web application when I try to get
> > HttpSession.
> > The problem is that the following code randomly returns _null_
> for
> > HttpSession.
> >
> > But next http request from different servlet using the same code
> is
> > fine. and when I call servlet with problem I've got null again.
> > Interesting, that if I wait for few minutes, this problem does
> not
> > exists: I'm getting a session object with no problems
> > Here the code:
> >
> > ------ cut ------
> > public void doPost( HttpServletRequest req, HttpServletResponse
> resp
> > )
> > throws IOException, ServletException
> > {
> > String cPath = req.getContextPath();
> > HttpSession ses = req.getSession(false);
> > /* ... ses is null sometimes ;(*/
> > ....
> > ----- end cut ----
> >
> >
> > Please note that I use req.getSession(true) in the login servlet
> and
> > DO know that session is created.
> >
> > Tech spec:
> > Software: tomcat 5.0.24 on Redhat FS2
> > Hardware: AMD 2700+, 512Mb, 120 GB HDD.
> >
> >
> > Any comments and suggestions are welcome.
> >
> > Thanks,
> > Mark.
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Take Yahoo! Mail with you! Get it on your mobile phone.
> > http://mobile.yahoo.com/maildemo
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]