users@glassfish.java.net

JSESSIONID no longer available in document.cookie from Glassfish v2 to v3

From: <forums_at_java.net>
Date: Thu, 2 Feb 2012 18:36:46 -0600 (CST)

In the process of upgrading an application from Glassfish v2.1.1. to
Glassfish v3.1.1. and found JavaScript code was breaking between versions. I
narrowed it down to the following code:

 

 


*var* isSessionActive = document.cookie;*
var* searchResult = isSessionActive.search('JSESSIONID');
i*f* (searchResult == -1){
// Do stuff
}

 

 

When I looked a the DOM through FireBug, I noticed that document.cookie was
missing JSESSIONID for v3:

"__utma=111872281.1952261444.1328220824.1328222792.1328228890.3;
__utmz=111872281.1328220824.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
siteLanguage=en_US; __utmb=111872281.2.10.1328228890; __utmc=111872281"

Here is document.cookie in v2:
"JSESSIONID=09e9debe1a482029054953560d98; JSESSIONIDVERSION=/profiler:13;
BIGipServerprofilerexpress-uat-pool=pTQnnEezPXHLgsw0G0SotJegE4pvXzvp9rQty8sOLXaNVsqZJZbJJqaOqhMDNhPdgkhcCJ25EIit2JU="
I do have a glassfish-web.xml in my WAR:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish
Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd [1]">
<glassfish-web-app>
<!-- add session config -->
<session-config>
<session-manager persistence-type="replicated">
<manager-properties>
<property name="persistenceFrequency" value="web-method" />
<property name="relaxCacheVersionSemantics" value="true"/>
</manager-properties>
<store-properties>
<property name="persistenceScope" value="session" />
</store-properties>
</session-manager>
<session-properties>
<property name="timeoutSeconds" value="1800" />
<property name="enableCookies" value="true"/>
<property name="enableURLRewriting" value="false"/>
</session-properties>
</session-config>
<resource-ref>
<res-ref-name>jdbc/profiler_pxp</res-ref-name>
<jndi-name>jdbc/profiler_pxp</jndi-name>
</resource-ref>
</glassfish-web-app>

I have tried removing this from the build, having a cookie property section
that specifically named JSESSIONID and compared the configuration between
server versions to assure I am not overriding anything. Can anyone help me
with where else I might be able to look in order to get JSESSIONID to be
available again?

Sincerely,

Michael


[1] http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd

--
[Message sent by forum member 'mikevoxcap']
View Post: http://forums.java.net/node/883241