You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by li...@itfrontier.co.jp on 2005/09/13 08:04:51 UTC

Session cookie is null

hi,


I have run the following code at Tomcat 5.0 and I got the sessionCookie, 
but when I run 
it at websphere 6, sessionCookie become null. so I can't continue the 
test.



    public void beginSuccessForward(WebRequest theRequest) {

        HttpSessionCookie sessionCookie = theRequest.getSessionCookie();
        assertNotNull("Session cookie should not be null", sessionCookie);
        theRequest.addCookie(sessionCookie);
     }


Thanks for any help you can provide.

Re: Session cookie is null

Posted by li...@itfrontier.co.jp.
hi, suguri


Thanks for your reply. 
I found the reason of error. I did't write the port number of Web Server 
in 
my cactus.properties. 

cactus.contextURL = http://localhost/test


after modify as following, I got the right result.

cactus.contextURL = http://localhost:80/test

thanks




Re: Session cookie is null

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi,

In article <OF...@itfrontier.co.jp>,
Tue, 13 Sep 2005 15:04:51 +0900,
liu_hongying@itfrontier.co.jp wrote: 
liu_hongying> I have run the following code at Tomcat 5.0 and I got the sessionCookie, 
liu_hongying> but when I run 
liu_hongying> it at websphere 6, sessionCookie become null. so I can't continue the 
liu_hongying> test.

liu_hongying> 
liu_hongying>     public void beginSuccessForward(WebRequest theRequest) {
liu_hongying> 
liu_hongying>         HttpSessionCookie sessionCookie = theRequest.getSessionCookie();
liu_hongying>         assertNotNull("Session cookie should not be null", sessionCookie);
liu_hongying>         theRequest.addCookie(sessionCookie);
liu_hongying>      }

This test is depending on server implementation and/or configuration.

Server can delay to issuing JSESSIONID until it is really needed.
AFAIK, Tomcat issues JESSIONID for the first request by default
(this is why your test works with Tomcat).
However, other container, such as WebSphere, may not.
# I'm not sure how WebSphere works.

If you need a valid session for testXXX method,
WebRequest#setAutomaticSession(boolean) may helps you.

Hope this helps,
----
Kazuhito SUGURI