AW: Tomcat will not create session cookie
Hello Christopher, you are right. It was a Firewall problem. Thanks for your help. Mario -Ursprüngliche Nachricht- Von: Christopher Schultz [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 13. Juni 2008 18:59 An: Tomcat Users List Betreff: Re: Tomcat will not create session cookie -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mario, mkweb wrote: | Hello, | I'm new to the forum. I have a strange problem with my tomcat installation. | I'm using tomcat5.5.26 and struts for my web projekt. | | I configured the project in a context file, like this : | Context path= docBase=C:\webprojekt debug=1 reloadable=true | crossContext=true cookies=true Remove the path and docbase attributes, then try again and let us know if you are still having problems. Where does your context.xml file live? | I set the attribute cookies to 'true' because I want to have session | cookies. cookies=true is the default, but it doesn't hurt to specify it. | My problem is now when I open the webapp with the url | http://localhost everything is fine. The session cookie wil be | created and the output of the script above is like : | Cookies : JSESSIONID=05E932958950B69BE03874B8FCE26C3E That doesn't sound like a problem. | But when I open the webapp over the internet with an URL like | www.myprojekt.com tomcat will not create an session cookie. Tomcat adds the | jsessionid to the URL's and teh output of the script above is : | Cookies : No cookies Are you operating over a proxy or firewall that strips cookies from requests and responses? Try using a tool like LiveHTTPHeaders (for Firefox) or a similar tool for whatever browser you are using to see what the client requests and server responses look like. | What is the problem ? Why can't tomcat create session cookie for | www.myprojekt.com ? Is your code ever actually creating a cookie? Or, are you expecting to see the JSESSIONID cookie only? If so, are you sure you have a session? You mentioned that your URL contains ;jsessionid=[the session id], so I would guess that's the case. Is the session working and consistent? If so, then the implication is that the cookie itself is being suppressed somewhere -- probably /not/ in Tomcat's code. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkhSp2sACgkQ9CaO5/Lv0PBUTACeKMzbgAZLZPiOrPe+vICX6YAi Qk4AnRdHn8sKhu3uaqPlzfh4kS8LEJjc =/Iw+ -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: AW: Tomcat will not create session cookie
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mario, Mario Killmer wrote: | Hello Christopher, | you are right. It was a Firewall problem. Thanks for your help. For the good of the list (and the archives), could you explain: 1. How you determined that the problem was your firewall 2. What type of firewall you have 3. How you were able to solve the problem (including any references) Thanks, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkhWumcACgkQ9CaO5/Lv0PBw2gCdGnb/QjNYnqJG97VQYF2ho7bT Z2EAoMPMVfJeChj7siB9UAgWNk11Zamj =0kI4 -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat will not create session cookie
- Original Message - From: mkweb [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Friday, June 13, 2008 11:44 AM Subject: Tomcat will not create session cookie Hello, I'm new to the forum. I have a strange problem with my tomcat installation. I'm using tomcat5.5.26 and struts for my web projekt. I configured the projekt in a context file, like this : Context path= docBase=C:\webprojekt debug=1 reloadable=true crossContext=true cookies=true I set the attribute cookies to 'true' because I want to have session cookies. Furthermore I added the following lines to the index.jsp to display the cookies : out.println(hCookies : /h); Cookie[] cookies=request.getCookies(); if(cookies==null) { out.println(No cookies); } else { Cookie MyCookie; for(int i=0;icookies.length;i++) { MyCookie=cookies[i]; out.println(MyCookie.getName() + =+MyCookie.getValue()); } } Mario, I dont use Struts... But this is what my code typically looks like HttpSession session = request.getSession(true); daBean= (DaBean)session.getAttribute(daBean); if (daBean== null) { // make new bean daBean= new daBean(); } else {// got session info } That getSession(true); makes the cookie if there isnt one... and struts probably has some XML that does this. Then the other thing is that you must send it when you send your form... its no good only making the sesion (cookie) when you trying to read the form data, its too late then. You dont have to set cookies=true its the default... and it means it will use cookies, but you still have to create the things. Somewhere underneath struts is doing this I guess... Hope that helps... --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat will not create session cookie
Hello, I'm new to the forum. I have a strange problem with my tomcat installation. I'm using tomcat5.5.26 and struts for my web projekt. I configured the projekt in a context file, like this : Context path= docBase=C:\webprojekt debug=1 reloadable=true crossContext=true cookies=true I set the attribute cookies to 'true' because I want to have session cookies. Furthermore I added the following lines to the index.jsp to display the cookies : out.println(hCookies : /h); Cookie[] cookies=request.getCookies(); if(cookies==null) { out.println(No cookies); } else { Cookie MyCookie; for(int i=0;icookies.length;i++) { MyCookie=cookies[i]; out.println(MyCookie.getName() + =+MyCookie.getValue()); } } My problem is now when I open the webapp with the url http://localhost everythink is fine. The session cookie wil be created and the output of the script above is like : Cookies : JSESSIONID=05E932958950B69BE03874B8FCE26C3E But when I open the webapp over the internet with an URL like www.myprojekt.com tomcat will not create an session cookie. Tomcat adds the jsessionid to the URL's and teh output of the script above is : Cookies : No cookies What is the problem ? Why can't tomcat create session cookie for www.myprojekt.com ? Thanks, Mario -- View this message in context: http://www.nabble.com/Tomcat-will-not-create-session-cookie-tp17819920p17819920.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat will not create session cookie
Hello, I'm new to the forum. I have a strange problem with my tomcat installation. I'm using tomcat5.5.26 and struts for my web projekt. I configured the projekt in a context file, like this : Context path= docBase=C:\webprojekt debug=1 reloadable=true crossContext=true cookies=true I set the attribute cookies to 'true' because I want to have session cookies. Furthermore I added the following lines to the index.jsp to display the cookies : out.println(hCookies : /h); Cookie[] cookies=request.getCookies(); if(cookies==null) { out.println(No cookies); } else { Cookie MyCookie; for(int i=0;icookies.length;i++) { MyCookie=cookies[i]; out.println(MyCookie.getName() + =+MyCookie.getValue()); } } My problem is now when I open the webapp with the url http://localhost http://localhost everythink is fine. The session cookie wil be created and the output of the script above is like : Cookies : JSESSIONID=05E932958950B69BE03874B8FCE26C3E But when I open the webapp over the internet with an URL like www.myprojekt.com tomcat will not create an session cookie. Tomcat adds the jsessionid to the URL's and teh output of the script above is : Cookies : No cookies What is the problem ? Why can't tomcat create session cookie for www.myprojekt.com ? Thanks, Mario
Re: Tomcat will not create session cookie
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mario, mkweb wrote: | Hello, | I'm new to the forum. I have a strange problem with my tomcat installation. | I'm using tomcat5.5.26 and struts for my web projekt. | | I configured the project in a context file, like this : | Context path= docBase=C:\webprojekt debug=1 reloadable=true | crossContext=true cookies=true Remove the path and docbase attributes, then try again and let us know if you are still having problems. Where does your context.xml file live? | I set the attribute cookies to 'true' because I want to have session | cookies. cookies=true is the default, but it doesn't hurt to specify it. | My problem is now when I open the webapp with the url | http://localhost everything is fine. The session cookie wil be | created and the output of the script above is like : | Cookies : JSESSIONID=05E932958950B69BE03874B8FCE26C3E That doesn't sound like a problem. | But when I open the webapp over the internet with an URL like | www.myprojekt.com tomcat will not create an session cookie. Tomcat adds the | jsessionid to the URL's and teh output of the script above is : | Cookies : No cookies Are you operating over a proxy or firewall that strips cookies from requests and responses? Try using a tool like LiveHTTPHeaders (for Firefox) or a similar tool for whatever browser you are using to see what the client requests and server responses look like. | What is the problem ? Why can't tomcat create session cookie for | www.myprojekt.com ? Is your code ever actually creating a cookie? Or, are you expecting to see the JSESSIONID cookie only? If so, are you sure you have a session? You mentioned that your URL contains ;jsessionid=[the session id], so I would guess that's the case. Is the session working and consistent? If so, then the implication is that the cookie itself is being suppressed somewhere -- probably /not/ in Tomcat's code. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkhSp2sACgkQ9CaO5/Lv0PBUTACeKMzbgAZLZPiOrPe+vICX6YAi Qk4AnRdHn8sKhu3uaqPlzfh4kS8LEJjc =/Iw+ -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]