Not able to handle the HTTP Session

Posted on

I'm facing issue on HTTP session on JBOSS 7.3.6. We have deployment as EAR file which has multiple war and jars.

1.New http session created on each request.
2. Invalidate the session and after creating the new session. Both session Id same.
mysession = httpServletRequest.getSession(false);
mysession .invalidate();
session = httpServletRequest.getSession(true);
If i compare both mysession.id and session .Id both are same.

snippet of Standalone-full-ha.xml

<subsystem xmlns="urn:jboss:domain:distributable-web:2.0" default-session-management="default" default-single-sign-on-management="default">
            <infinispan-session-management name="default" cache-container="web" granularity="SESSION">
                <primary-owner-affinity/>
            </infinispan-session-management>
            <infinispan-single-sign-on-management name="default" cache-container="web" cache="sso"/>
            <infinispan-routing cache-container="web" cache="dist"/>
        </subsystem>

<subsystem xmlns="urn:jboss:domain:infinispan:9.0">
            <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan" statistics-enabled="true">
                <transport lock-timeout="60000"/>
                <replicated-cache name="sso" />
                <replicated-cache name="routing"/>
                <distributed-cache name="dist">
                  <file-store/>
                </distributed-cache>
            </cache-container>
</subsystem

<subsystem xmlns="urn:jboss:domain:undertow:10.0" instance-id="${dap.peer.id}" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="true">
            <buffer-cache name="default"/>
            <server name="default-server">

                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true" max-parameters="10000" no-request-timeout= "900000"/>

                <host name="default-host" alias="localhost">
                    <filter-ref name="requestDumperExpression"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                    <access-log pattern="%a %l %t %p %H %m %U %s %T" rotate="false" prefix="access."/>
        </host>
                <https-listener name="defaults" socket-binding="https" security-realm="HTTPSRealm" max-parameters="10000" no-request-timeout= "900000"/>
        </server>
            <servlet-container name="default">
                <jsp-config/>
                <session-cookie name="RPTLJSESSIONID" http-only="true" secure="true"/> <!-- added -->
                <websockets/>
            </servlet-container>
            <handlers>
                <!--<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>-->
            </handlers>
            <filters>
                <expression-filter name="requestDumperExpression" expression="dump-request"/>
            </filters>
        </subsystem>

jboss-all.xml

<jboss xmlns="urn:jboss:1.0">
<shared-session-config xmlns="urn:jboss:shared-session-config:1.0">
<max-active-sessions>50</max-active-sessions>
<session-config>
<session-timeout>900</session-timeout>
<cookie-config>
<name>RPTLJSESSIONID</name>
<http-only>true</http-only>
<secure>true</secure>
<!-- <max-age>-1</max-age> -->
</cookie-config>
<tracking-mode>COOKIE</tracking-mode>
</session-config>
</jboss>

Each war file contain -

/WEB-INF/jboss-web.xml

<distributable-web xmlns="urn:jboss:distributable-web:2.0">
<infinispan-session-management cache-container="web" granularity="SESSION">
<primary-owner-affinity/>
</infinispan-session-management>
</distributable-web>
</jboss>

/WEB-INF/distributable-web.xml

<jboss xmlns="urn:jboss:1.0">
    <distributable-web xmlns="urn:jboss:distributable-web:2.0">
      <infinispan-session-management cache-container="web" granularity="SESSION">
        <primary-owner-affinity/>
      </infinispan-session-management>
    </distributable-web>
</jboss>

Interesting this is there no matter whether distributable tag exist in web.xml. I have tested with and without. Nothing happen.

Let me know what i'm doing wrong here to handle http session correctly. Please help me here.

Responses