Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with sessions on weblogic

i've faced a strange problem with weblogic. One of our workstations hosts 2 weblogic instances. The problem is when i log in to one of them, session on another automatically expires and vice versa. What can it be? How to deal with this problem?

like image 818
mykola Avatar asked Dec 16 '10 12:12

mykola


2 Answers

If the session id is stored within a cookie on the client side, make sure the cookie name is not the same on both your weblogic instances.

One way to change the cookie name is to create a file named weblogic.xml in your webapps (or weblogic-application.xml in your EARs, just replace the tag weblogic-web-app by weblogic-application) containing the following (customize the cookie name according to your needs):

<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
    <session-descriptor>
        <cookie-name>MyCookieName</cookie-name>
    </session-descriptor>
</weblogic-web-app>
like image 141
nawre Avatar answered Nov 01 '22 10:11

nawre


since they are running on the same machine, your browser sees one host (i.e. localhost). since the default session cookie for java webapps is JSESSIONID and both are using this cookiename they will overwrite each other.

A solution is to open 2 IE browser windows by starting IE twice. In that case they will get their own session cookie. Unfortunalty this doesn't work for Firefox and Chrome.

An other solution is mentioned by nawre, by giving the 2 webapps a different session cookie name.

like image 27
Salandur Avatar answered Nov 01 '22 09:11

Salandur