2

I'm using a Tomcat 7 server (Xampp for development) and I have the following apps deployed:

Tomcat/Webapps/App1 (FrontOffice)
Tomcat/Webapps/App2 (BackOffice)

the App2 is generating a Cookie (session.setAttribute("X","myValue")) that I need to retrieve on my App1 (via a jsp page by using $(X)).

This solution is working well if I'm deploying a unique application containing both app1 and app2. But for deployment reason, I need to separate Front and BackOffice.

So I tried to configure my Tomcat server to enable session Cookie for any app of my Context.

Here are the updates I performed:

on my Tomcat conf/context.xml:

<Context sessionCookiePath="/" crossContext="true">...

on my App2 Web.xml:

<session-config>
<session-timeout>30</session-timeout>
<cookie-config>
<path>/</path>
</cookie-config>
</session-config>

I restarted Tomcat but from my App1, I'm not able to retrieve session attributes created by my App2.

May be I'm missing something ?

tiamat
  • 879
  • 2
  • 12
  • 35
  • "a unique application containing both app1 and app2". What do you call an application ?? – Eugène Adell Apr 09 '18 at 21:56
  • 1
    If I understand well your question, then it looks like a duplicate of : https://stackoverflow.com/questions/665941/any-way-to-share-session-state-between-different-applications-in-tomcat – Eugène Adell Apr 09 '18 at 21:57
  • sorry for my bad explanation...by app I meant ".war", if I'm deploying only one war file on tomcat, I can access my session attributes, If I'm deploying two independent war files I cannot. Tomcat SessionManagement is also interesting for me to manage timeout sessions – tiamat Apr 10 '18 at 07:32
  • that's right, I finally succeeded by using the previous message shared by Eugène. Thanks ! – tiamat Apr 10 '18 at 07:48
  • That's good, don't forget to mark the comment as useful, it can help someone. – Eugène Adell Apr 10 '18 at 08:03

0 Answers0