How to share the session in multiple WAR in EAR file in JBOSS-7.3.6

606 views Asked by At

How to share the session in multiple WAR in EAR file in JBOSS-7.3.6 ?

we have following entry in jboss-all.xml JBoss 7.2 version (before migration)

<jboss xmlns="urn:jboss:1.0">
    <shared-session-config xmlns="urn:jboss:shared-session-config:1.0">
        <max-active-sessions>10</max-active-sessions>
        <session-config>
            <session-timeout>0</session-timeout>
            <cookie-config>
                <name>JSESSIONID</name>
                <domain>domainName</domain>
                <path>/cookiePath</path>
                <comment>cookie comment</comment>
                <http-only>true</http-only>
                <secure>true</secure>
                <max-age>-1</max-age>
            </cookie-config>
            <tracking-mode>COOKIE</tracking-mode>
        </session-config>
        <replication-config>
            <cache-name>web</cache-name>
            <replication-granularity>SESSION</replication-granularity>
        </replication-config>
    </shared-session-config>
</jboss>

But now I'm putting the same xml.. or below xml snippet but could not work in JBOSS-7.3.6

 <shared-session-config xmlns="urn:jboss:shared-session-config:2.0">
<distributable/> 
        <max-active-sessions>10</max-active-sessions>
 -- rest copy from above

getting the following exception

21:50:31,221 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to URL: java.lang.IllegalStateException: WFLYCLWEBUT0001: Session idKL5QLs4873uTTnzT6JFg03_avxMEa8Q1-B4Jy4 is invalid
        at org.wildfly.clustering.web.undertow.session.DistributableSession.validate(DistributableSession.java:265)
        at org.wildfly.clustering.web.undertow.session.DistributableSession.validate(DistributableSession.java:257)

Can anyone suggest how to achieve ?

Thanks in advance !

1

There are 1 answers

2
Panagiotis Chavariotis On

First of all you have to know that sharing sessions between web applications would violate the JavaEE Servlet specification! That means your applications may not be portable! However you can check the coresponding documentation for more info: Development Guide / Configuring Session Sharing Between Subdeployments In Enterprise Archives