I believe the problem has to do with the initialization of the random
number generation used for generating session id's. That's why it only
happens on the first request.
To get around this you can force the initialization in a startup
servlet. Try something like this:
new java.security.SecureRandom().nextLong();
Hope this helps.
Mike Curwen wrote:
>Hi,
>
>This is a closely related question, so thought I'd use this thread.
>
>I'm the co-moderator of a Java Servlets forum, and a question came up
>recently that I have never heard of before. It seems a user has found that
>request.getSession() takes a very long time to return if he is using
>Netscape browser version 4.x, as opposed to using IE. It has baffled me so
>far, has anyone ever run across this situation? ps: we're talking minutes,
>not just 5 seconds.
>
>http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=7&t=0071
>39
>
>There is the link, and I thank anyone for contributing either on this
>mailing list, or in the forum.
>
>>From: "Katsuyuki Michishita" <kmichishita@imobile.co.jp>
>>To: <tomcat-user@jakarta.apache.org>
>>Sent: Friday, January 11, 2002 12:00 PM
>>Subject: getSession take too mush time.
>>
>>
>>>request.getSession() take 5 second to execute the code.
>>>one of person answer me following:
>>>"is it tomcat? then it's because sessionids are computed by
>>>
>SecureRandom.
>
>>>First
>>>number takes about 5 seconds, thats normal"
>>>
>>>So this is happen only first time of execution?
>>>I do not have to worry this a day later?
>>>
>>>thank you
>>>
>>>-Kats
>>>