Re: Http session lost b/w struts actions on Linux but not in Win
As Johan already pointed (or almost pointed ) out. check the domain & path of the JSESSIONID cookie . If those are different then that's why you get 2 of them. Evgeny On Wed, Dec 23, 2009 at 10:52 AM, Johan Thorselius < johan.thorsel...@gmail.com> wrote: > Hi Ron, > > Actually, there is an Apache in front of Tomcat when on Linux (sorry about > that vital detail), can that create the problem ? > > I will check the configuration of Apache with other staff, can't be before > x-mas. > > Thanks - Johan > > > 2009/12/23 Ron McNulty > > > Hi Johan > > > > Two JSESSIONID values does look odd. I've seen problems like this when > > another server running a Java J2EE servlet container incorrectly had its > > JSESSIONID cookie scope set to the whole domain, rather than scoped to > the > > server and application. In my case it was a SAP web server, and the > session > > ID value was readily recognisable, and quite different to Tomcat values. > > > > That may also explain the Linux/Windows difference if your development > > boxes are on Windows and the production/test boxes are on Linux. > > > > Regards > > > > Ron > > > > - Original Message ----- From: "Johan Thorselius" < > > johan.thorsel...@gmail.com> > > To: "Tomcat Users List" > > Sent: Tuesday, December 22, 2009 11:38 PM > > Subject: Re: Http session lost b/w struts actions on Linux but not in Win > > > > > > > > I here add some info from Firebug which may be significant. > >> > >> 'GET localhost:8080/wap-app/start.action': > >> > >> CookieJSESSIONID=9726CDF4A527E3D98451140AB69EFA2C; > >> JSESSIONID=BEED739340DDD4370C85A9D12917692A > >> > >> 'GET localhost:8080/webdav/images/.../1px.gif': > >> > >> CookieJSESSIONID=BEED739340DDD4370C85A9D12917692A > >> > >> Johan > >> > >> > >> > >> 2009/12/22 Johan Thorselius > >> > >> 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 > >>> > >>> -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 > >>>&g
Re: Http session lost b/w struts actions on Linux but not in Win
In a valve Request.getSession() can return null. See how it is implemented. (org.apache.catalina.connector.Request) -> getSession(), doGetSession(boolean) I do not know, why it happens in your circumstances. 2009/12/23 Johan Thorselius : > Hi Ron, > > Actually, there is an Apache in front of Tomcat when on Linux (sorry about > that vital detail), can that create the problem ? > > I will check the configuration of Apache with other staff, can't be before > x-mas. > > Thanks - Johan > > > 2009/12/23 Ron McNulty > >> Hi Johan >> >> Two JSESSIONID values does look odd. I've seen problems like this when >> another server running a Java J2EE servlet container incorrectly had its >> JSESSIONID cookie scope set to the whole domain, rather than scoped to the >> server and application. In my case it was a SAP web server, and the session >> ID value was readily recognisable, and quite different to Tomcat values. >> >> That may also explain the Linux/Windows difference if your development >> boxes are on Windows and the production/test boxes are on Linux. >> >> Regards >> >> Ron >> >> - Original Message - From: "Johan Thorselius" < >> johan.thorsel...@gmail.com> >> To: "Tomcat Users List" >> Sent: Tuesday, December 22, 2009 11:38 PM >> Subject: Re: Http session lost b/w struts actions on Linux but not in Win >> >> >> >> I here add some info from Firebug which may be significant. >>> >>> 'GET localhost:8080/wap-app/start.action': >>> >>> CookieJSESSIONID=9726CDF4A527E3D98451140AB69EFA2C; >>> JSESSIONID=BEED739340DDD4370C85A9D12917692A >>> >>> 'GET localhost:8080/webdav/images/.../1px.gif': >>> >>> Cookie JSESSIONID=BEED739340DDD4370C85A9D12917692A >>> >>> Johan >>> >>> >>> >>> 2009/12/22 Johan Thorselius >>> >>> 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 >>>> >>>> -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 >>>>> meth
Re: Http session lost b/w struts actions on Linux but not in Win
Hi Ron, Actually, there is an Apache in front of Tomcat when on Linux (sorry about that vital detail), can that create the problem ? I will check the configuration of Apache with other staff, can't be before x-mas. Thanks - Johan 2009/12/23 Ron McNulty > Hi Johan > > Two JSESSIONID values does look odd. I've seen problems like this when > another server running a Java J2EE servlet container incorrectly had its > JSESSIONID cookie scope set to the whole domain, rather than scoped to the > server and application. In my case it was a SAP web server, and the session > ID value was readily recognisable, and quite different to Tomcat values. > > That may also explain the Linux/Windows difference if your development > boxes are on Windows and the production/test boxes are on Linux. > > Regards > > Ron > > - Original Message - From: "Johan Thorselius" < > johan.thorsel...@gmail.com> > To: "Tomcat Users List" > Sent: Tuesday, December 22, 2009 11:38 PM > Subject: Re: Http session lost b/w struts actions on Linux but not in Win > > > > I here add some info from Firebug which may be significant. >> >> 'GET localhost:8080/wap-app/start.action': >> >> CookieJSESSIONID=9726CDF4A527E3D98451140AB69EFA2C; >> JSESSIONID=BEED739340DDD4370C85A9D12917692A >> >> 'GET localhost:8080/webdav/images/.../1px.gif': >> >> CookieJSESSIONID=BEED739340DDD4370C85A9D12917692A >> >> Johan >> >> >> >> 2009/12/22 Johan Thorselius >> >> 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 >>> >>> -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): >>>> > . >>>> > . >>>> >
Re: Http session lost b/w struts actions on Linux but not in Win
Hi Johan Two JSESSIONID values does look odd. I've seen problems like this when another server running a Java J2EE servlet container incorrectly had its JSESSIONID cookie scope set to the whole domain, rather than scoped to the server and application. In my case it was a SAP web server, and the session ID value was readily recognisable, and quite different to Tomcat values. That may also explain the Linux/Windows difference if your development boxes are on Windows and the production/test boxes are on Linux. Regards Ron - Original Message - From: "Johan Thorselius" To: "Tomcat Users List" Sent: Tuesday, December 22, 2009 11:38 PM Subject: Re: Http session lost b/w struts actions on Linux but not in Win I here add some info from Firebug which may be significant. 'GET localhost:8080/wap-app/start.action': CookieJSESSIONID=9726CDF4A527E3D98451140AB69EFA2C; JSESSIONID=BEED739340DDD4370C85A9D12917692A 'GET localhost:8080/webdav/images/.../1px.gif': CookieJSESSIONID=BEED739340DDD4370C85A9D12917692A Johan 2009/12/22 Johan Thorselius 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 -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 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Http session lost b/w struts actions on Linux but not in Win
I here add some info from Firebug which may be significant. 'GET localhost:8080/wap-app/start.action': CookieJSESSIONID=9726CDF4A527E3D98451140AB69EFA2C; JSESSIONID=BEED739340DDD4370C85A9D12917692A 'GET localhost:8080/webdav/images/.../1px.gif': CookieJSESSIONID=BEED739340DDD4370C85A9D12917692A Johan 2009/12/22 Johan Thorselius > 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 > > -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 >> >> >
Re: Http session lost b/w struts actions on Linux but not in Win
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 > -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 > >
Re: Http session lost b/w struts actions on Linux but not in Win
Thanks, but the folder permissions where already like >> drwxr-xr-x Johan 2009/12/17 Martin Gainty > > sounds like a permissions error on the work folders > /tomcat/apache-tomcat-6.0.18/work > fu...@127.0.0.1 /tomcat/apache-tomcat-6.0.18/work > $ ls -al > total 0 > drwx--+ 3 0 > > at a min i would turn on read/execute for tomcat work folder > chmod +x . > chmod +r . > > $ ls -al > total 0 > drwxr-xr-x+ 3 0 Oct 7 19:43 . > > Martin Gainty > __ > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité > > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht > dient lediglich dem Austausch von Informationen und entfaltet keine > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le > destinataire prévu, nous te demandons avec bonté que pour satisfaire > informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie > de ceci est interdite. Ce message sert à l'information seulement et n'aura > pas n'importe quel effet légalement obligatoire. Étant donné que les email > peuvent facilement être sujets à la manipulation, nous ne pouvons accepter > aucune responsabilité pour le contenu fourni. > > > > > > Date: Thu, 17 Dec 2009 13:52:59 +0100 > > Subject: Http session lost b/w struts actions on Linux but not in Win > > From: johan.thorsel...@gmail.com > > To: users@tomcat.apache.org > > > > request.getSession() returns an incorrect null on Linux, but on Windows > it's > > OK. > > > > 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 first request the session is not lost, everything is fine with (2) > > and (4). In the following requests getSession() returns null (1) and (3). > > > > This occurs on Linux, not on Windows, both with 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 > > > > > > Regards > > > > Johan > > _ > Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. > http://clk.atdmt.com/GBL/go/171222985/direct/01/ >
Re: Http session lost b/w struts actions on Linux but not in Win
-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
Re: Http session lost b/w struts actions on Linux but not in Win
On 17/12/2009 12:52, Johan Thorselius wrote: request.getSession() returns an incorrect null on Linux, but on Windows it's OK. 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 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 encoding all of your URLs with response.encodeURL()? To clarify, you are saying that the server is refusing to create a session at event (3)? When you say the valve repeatedly executes invoke(), presumably you mean only once per request? p This occurs on Linux, not on Windows, both with 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 Regards Johan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Http session lost b/w struts actions on Linux but not in Win
sounds like a permissions error on the work folders /tomcat/apache-tomcat-6.0.18/work fu...@127.0.0.1 /tomcat/apache-tomcat-6.0.18/work $ ls -al total 0 drwx--+ 3 0 at a min i would turn on read/execute for tomcat work folder chmod +x . chmod +r . $ ls -al total 0 drwxr-xr-x+ 3 0 Oct 7 19:43 . Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Thu, 17 Dec 2009 13:52:59 +0100 > Subject: Http session lost b/w struts actions on Linux but not in Win > From: johan.thorsel...@gmail.com > To: users@tomcat.apache.org > > request.getSession() returns an incorrect null on Linux, but on Windows it's > OK. > > 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 first request the session is not lost, everything is fine with (2) > and (4). In the following requests getSession() returns null (1) and (3). > > This occurs on Linux, not on Windows, both with 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 > > > Regards > > Johan _ Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. http://clk.atdmt.com/GBL/go/171222985/direct/01/
Http session lost b/w struts actions on Linux but not in Win
request.getSession() returns an incorrect null on Linux, but on Windows it's OK. 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 first request the session is not lost, everything is fine with (2) and (4). In the following requests getSession() returns null (1) and (3). This occurs on Linux, not on Windows, both with 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 Regards Johan