Hi Oscar,
Why don't you just use
HttpSession sesion=requ.getSession(true); //create a new session if none
because you create a new session if there isn't anyway.
At 08:06 AM 2/19/01 +0100, you wrote:
>Hi,
>
>I use Servlets/JDBC/ServletExec/SQL Server 7/IIS4/WinNT.
>I'm working with a servlet application, and everything worked fine until
>yesterday. I could create a session and see its ID (with daemon.exe), but
>when I go to the next servlet I can't.
>
>servlet 1
>
> HttpSession sesion=requ.getSession(false);
> try
> { sesion.invalidate(); } //invalidate other
> sessions
> catch (NullPointerException ex) { }
> sesion=requ.getSession(true); //create new
>
> System.out.println("SesionID:"+sesion.getId()); --> WORKS
>
>servlet 2
>
> HttpSession sesion=requ.getSession(false); //don't
> create if exists one
>(it is supose to)
>
> System.out.println("SesionID:"+sesion.getId()); --> GET
> NullPointerException
>
>
>This code worked before... I don't know what can have changed.
>Summaryzing, in servlet1 is created a session, but when we go to other
>servlet (id. servlet2) ¡there is no session! --> would get
>NullPointerException (...obviolusly).
>
>I've managed this session tracking issue before without problems, but now,
>it doesn't work.
>The problem it's not caused by the servlet engine (I've checked it).
>
>I hope someone can give me any clue.
>
>Regards,
>
>Oscar.
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html