Hi Greg,

I remember Tomcat Manager had an option titled "keep session" when you deploy. Have you seen/tried it?

Regards

On 8/14/2022 11:54 AM, Greg Huber wrote:
I have an issue when I redeploy my war via tomcat manager.

eg If I have an active session, ie I am using my application, then I redeploy a new version of the war, the token helper seems to loose the session token :

2022-08-13 07:07:18,705 WARN  org.apache.struts2.util.TokenHelper TokenHelper:validToken - Form token E9TSCAMBY5AL0Z7TA0RNKJ83KY9XK8F2 does not match the session token null. 2022-08-13 07:07:21,952 WARN  org.apache.struts2.util.TokenHelper TokenHelper:validToken - Form token FGHUJQPU552FTQ6KG8Y8CR3DPH3G1VSX does not match the session token null. 2022-08-13 07:07:23,101 WARN  org.apache.struts2.util.TokenHelper TokenHelper:validToken - Form token PX7FL87XNZA4EK1TBC25BNU5MTBEPQV2 does not match the session token null. 2022-08-13 07:07:24,002 WARN  org.apache.struts2.util.TokenHelper TokenHelper:validToken - Form token 7SA02JFB2ASPB9P9P9J6AC0DVEWW3PSK does not match the session token null. 2022-08-13 07:07:24,804 WARN  org.apache.struts2.util.TokenHelper TokenHelper:validToken - Form token 3S1BNJBLOXILUAJLPLL5MBUQREHVQ7G3 does not match the session token null. 2022-08-13 07:07:25,889 WARN  org.apache.struts2.util.TokenHelper TokenHelper:validToken - Form token B2QB8B97K39ZMO6APHVM2BE3DURW2EWI does not match the session token null.

None of my crud screens work, it just returns to the input with no errors.

To fix this I have to manually logoff and on again.

I cannot work out how to reset the session token.  Is this normal when redeploying an app?


       <interceptor-ref name="tokenSession">
           <param name="includeMethods">save</param>
       </interceptor-ref>

TokenHelper:

Map session = ActionContext.getContext().getSession();
        String tokenSessionName = buildTokenSessionAttributeName(tokenName);
         String sessionToken = (String) session.get(tokenSessionName);

         if (!token.equals(sessionToken)) {
             if (LOG.isWarnEnabled()) {
                LocalizedTextProvider localizedTextProvider = ActionContext.getContext().getContainer().getInstance(LocalizedTextProvider.class); LOG.warn(localizedTextProvider.findText(TokenHelper.class, "struts.internal.invalid.token", ActionContext.getContext().getLocale(), "Form token {0} does not match the session token {1}.", new Object[]{
                         token, sessionToken
                 }));
             }

             return false;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to