You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mario Killmer <in...@mk-webservices.de> on 2008/06/13 11:56:34 UTC

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("<h>Cookies : </h>"); 
Cookie[] cookies=request.getCookies(); 
if(cookies==null) { 
out.println("No cookies"); 
} else { 
Cookie MyCookie; 
for(int i=0;i<cookies.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