2016-01-11 160 views
0

在WebLogic中,我有自定义cookie名称的要求,会话管理,我用我的weblogic.xml以下定义Cookie的会话持久性

<session-descriptor> 
    <timeout-secs>7200</timeout-secs> 
    <cookies-enabled>true</cookies-enabled> 
    <persistent-store-type>cookie</persistent-store-type> 
    <persistent-store-cookie-name>MY_PARAM</persistent-store-cookie-name> 
</session-descriptor> 

了下面那个把一个数到会话中的语句错误...

java.lang.IllegalArgumentException: Cookie based sessions support 
    attributes of 
    type "String" only; could not set attribute: CUSTID 
      at 
    weblogic.servlet.internal.session.CookieSessionData.setAttribute(Cook 
    ieSessionData.java:63) 

这在早期使用自定义cookie名称进行持久性时工作正常。我错过了什么吗?我能做些什么,以避免因定制cookie名称要求更改代码 UPDATE:

myCustId是一个数字,我试图把它放在CUSTID会议attributr:

session.setAttribute("CUSTID", myCustId); 

于是,经过上面的错误,如果我改变下面的代码,问题就解决了。

session.setAttribute("CUSTID", myCustId.toString()); 

但我不想做这些更改,因为许多其他这样的数字字段设置为会话属性。

+0

你的代码是什么样的设置属性? –

+0

请参阅我的问题更新 – rags

回答