The issue now boils down to the following a bit strange thing. Any idea why
this happens ?


- request.getSession() returns an incorrect null on Linux, but on Windows
it's OK - under the following circumstances:

When using Firebug on Firefox I noted that a corporate common .css
references a 1-pixel gif which is not present and visible, hence there is a
'404 Not found' error for the 'GET
localhost:8080/webdav/images/.../1px.gif'. But the preceding 'GET
localhost:8080/wap-app/start.action' is fine.

In my myValve-class on Linux:

'GET localhost:8080/wap-app/start.action' => myValve.invoke() ...
request.getSession() returns a correct session object

'GET localhost:8080/webdav/images/.../1px.gif' => myValve.invoke() ...
request.getSession() and request.getSession(true) both returns null

Same code and same build, in my myValve-class on Windows:

Both GET => myValve.invoke() ... request.getSession() returns a correct
session object


The webapp is built with Struts2/Spring.

Both Linux and Windows uses Tomcat 6.0.20.

On Windows Java version 1.6.0_16 is used

On RedHat Linux Java version 1.6.0_13 is used

and..

>> In the "log incorrect event" code, do you return
>> from the valve, or do you continue processing?

The execution continues down to the bottom with 'getNext().invoke(req,resp)'

Johan


2009/12/17 Christopher Schultz <ch...@christopherschultz.net>

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Johan,
>
> On 12/17/2009 7:52 AM, Johan Thorselius wrote:
> > request.getSession() returns an incorrect null on Linux, but on Windows
> it's
> > OK.
>
> That's odd... request.getSession() should never return null. This method:
>
> "
> Returns the current session associated with this request, or if the
> request does not have a session, creates one.
> "
>
> > I have an ordinary Struts2 web app deployed on Tomcat 6.0.20, together
> with
> > a JAAS-solution where I have my own Valve class.
> >
> > The Valve repeatedly executes invoke() with the following code-snippet
> (here
> > very much simplified):
> >   .
> >   .
> >   .
> >   if (LOGGER.isDebugEnabled()) {
> >     if (request.getSession() == null) {
> >       // Log incorrect event (1)
> >     } else {
> >       // Log OK (2)
> >     }
> >     if (request.getSession(true) == null) {
> >       // Log incorrect event (3)
> >     } else {
> >       // Log OK (4)
> >     }
> >   }
> >
> >   /*
> >    * Here a NullPointerException occurs
> >    */
> >   request.getSession().setAttribute("...",...);
>
> In the "log incorrect event" code, do you return from the valve, or do
> you continue processing?
>
> > In the first request the session is not lost, everything is fine with (2)
> > and (4). In the following requests getSession() returns null (1) and (3).
>
> Are you storing the request object anywhere and perhaps using it after
> it's been recycled?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAksqoSoACgkQ9CaO5/Lv0PDZ7QCfXwdUPAoU9EPxlEC64f11rlAa
> +0oAoJG3hjVFYbeCvkrXQ14bkvlq9bJZ
> =lF2t
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to