Weblogic multi-application deployment in one domain causes session conflicts

Solution to the problem of session conflict caused by Weblogic multi-application deployment in one domain

 

       Recently , multiple applications have been deployed under a domain of Weblogic at the same time, and there has been a problem of session conflict. The phenomenon is like this. Access A is normal, but after jumping from application A to application B , the session of application A is invalid immediately. Because I have encountered a similar situation on tomcat before , I immediately thought that it should be the problem of session conflict. Every application will write a cookie named jsessionid when writing a cookie that saves session information . The effect achieved in this way is that when application A is accessed first, application A writes a cookie named jsessionid to save its session id . As a result, application B saves its session id through jsessionid when accessing application B.The id of the session , thus overwriting the sessionid of the A application , and the session of the A application will be lost the next time the A application is accessed .

       The solution is to create a new weblogic.xml file in the WEB-INF directory of the application, and specify the cookie name for saving session information through the CookieName of the session-param of its session-descriptor to ensure that the CookieName between each application is unique.

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 12.1//EN" "http://xmlns.oracle.com/weblogic/weblogic-web-app/1.5/weblogic-web-app.xsd">
<weblogic-web-app>
    <session-descriptor>
            <session-param>
                  <param-name>CookieName</param-name>
                  <param-value>App session id</param-value>
            </session-param>
    </session-descriptor>
</weblogic-web-app>

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326676468&siteId=291194637