属性未在会话中保存

时间:2013-01-03 17:14:33

标签: java servlets session-variables session-cookies sessionid

我有一个webapp,它在我的本地环境中工作得很好但是当我将它部署到其他应用服务器时,会话部分出现了问题。

在一个servlet中,我将会话属性存储为

session.setAttribute("customer", customerObj)

在其他servlet中,我将此属性作为

session = request.getSession();
Customer customer = (Customer) session.getAttribute("customer")

我发现该客户为空。当我为每个请求检查jSessionId时,Ids是相同的。是什么导致这个问题? appServers之间是否存在可能存在配置差异的可能性?

由于

weblogic.xml中的

会话描述符就像这样

<session-descriptor>
        <session-param>
            <param-name>CookiesEnabled</param-name>
            <param-value>true</param-value>
        </session-param>

        <session-param>
            <param-name>TrackingEnabled</param-name>
            <param-value>true</param-value>
        </session-param>

        <session-param>
            <param-name>CookieDomain</param-name>
            <param-value>.blabla.com.</param-value>
        </session-param>

        <session-param>
            <param-name>CookieComment</param-name>
            <param-value>Blabla Session Tracking Cookie</param-value>
        </session-param>

        <session-param>
            <param-name>CookieName</param-name>
            <param-value>BSession</param-value>
        </session-param>

        <session-param>
            <param-name>IDLength</param-name>
            <param-value>10</param-value>
        </session-param>

        <session-param>
            <param-name>CookieMaxAgeSecs</param-name>
            <param-value>-1</param-value>
        </session-param>

        <session-param>
            <param-name>PersistentStoreCookieName</param-name>
            <param-value>WLCOOKIE</param-value>
        </session-param>

        <session-param>
            <param-name>PersistentStoreType</param-name>
            <param-value>memory</param-value>
        </session-param>

        <session-param>
            <param-name>URLRewritingEnabled</param-name>
            <param-value>true</param-value>
        </session-param>

        <session-param>
            <param-name>InvalidationIntervalSecs</param-name>
            <param-value>60</param-value>
        </session-param>
        <session-param>
            <param-name>TimeoutSecs</param-name>
            <param-value>540</param-value>
        </session-param>

    </session-descriptor>

0 个答案:

没有答案