HttpSession sharing between WAR modules

Latest response

Hello,

I am trying to migrating my J2EE app from WebSphere 6.1 to JBoss EAP 6.1. My app is composed of two WAR modules and deployed as EAR file.

With WebSphere, we can easily share session between the two WARs by changing settings in the admin console, but it looks like it is not an easy task for JBoss. I have been searching on the web to find a solution, but no luck so far.

This is the related post that I found, https://issues.jboss.org/i#browse/JBAS-2861

I couldn't find any thread on this topic here, if there is alreay a discussion, please redirect.

Thanks,
WL

Responses

Hi,

There is no supported built-in feature to do this in JBoss as sharing sessions between web applications would violate the JavaEE Servlet specification:

7.3 Session Scope
HttpSession objects must be scoped at the application (or servlet context) level.

The following feature request JIRAs were opened for the community versions and also another internal RFE JIRA had been opened for EAP 6. Currently these has not yet been completed and unfortunately no estimated time of arrival:

Please also refer to the knowledge https://access.redhat.com/site/solutions/18530.

Thanks,
Masafumi

Hi Masafumi,

Thanks for your reply. I checked the solution link you provided, https://access.redhat.com/site/solutions/18530, it looks like there is a workaround for EAP 4.x and EAP 5.x, but I don't see there is one for EAP 6.x.

The configuration for EAP 6.x is quite different from 5.x, so it's not very possible to following the instruction for EAP 5.x. I understand the recommended solution for this requirement of session sharing is to use JBoss Cache, but I am new to JBoss, it will take me some time to figure out how to use JBoss Cache.

Please let me know if there is a workaround for EAP6.1.

Truly appreciate your help.

Thanks,
WL

Hi,

Sorry for late response.

First, as noted in the solution 18530, the PersistentValve approach is considered experimental and not officially supported. We do not recommend using it.

Regarding JBoss Cache, it's replaced to infinispan in EAP 6. Using infinispan API directly needs JBoss Data Grid (JDG) subscription in addtion to EAP one. (If you want to try it, please use JDG 6 with EAP 6. It's difficult to say further details about it here. Please refer to the Developer Guide (https://access.redhat.com/site/documentation/en-US/Red_Hat_JBoss_Data_Grid/) and JDG QuickStarts for the example implementation and usage of JDG.

Thanks,
Masafumi