How do I maintain the same session ID for multiple web applications in a Jboss server?
问题:
回答1:
Take a look at this post, for similar question. Access session of another web application
What this is saying is
"Not directly. Most containers put each WAR in a separate classloader with the EAR classloader as their parent. Each app's sessions are separate. You can put something provided by the parent EAR in each session. If you need them to share something, make it a EAR function."
So, due to the each session being private, one web-app cannot see the other. So, your option is to bundle the two web apps in a single WAR file, to make them be able to share session data.
回答2:
I was looking for this recently and found a solution.
If you just want to share the ID, you can use the following configuration in web.xml. Given that you use servlet 3.0.
<session-config>
<cookie-config>
<path>/</path>
</cookie-config>
</session-config>
This will save the jsessionid cookie with path "/" making it shared among all webapps. This is how JBoss 4 used to do it.