How to set session-time for Java Web Application deployed on WebLogic?
Two Ways to Set session-time
There are two places to set session timeout for java web application if it will deploy on WebLogic.
- web.xml
- weblogic.xml
web.xml, set timeout as 60 minutes.
<session-config>
<session-timeout>60</session-timeout>
</session-config>
<session-descriptor>
<timeout-secs>3600</timeout-secs>
<invalidation-interval-secs>60</invalidation-interval-secs>
</session-descriptor>
Priority between them
I saw some posts said setting in web.xml takes precedence over weblogic.xml.
It may be right except weblogic11g. Because I tested both ways in my project, which is running on weblogic11g. The relationships between these two ways depend on how the container support them.
Behavior on WebLogic11g
- if you use weblogic.xml and web.xml, weblogic will only adop the settings in weblogic.xml.
- If you only use web.xml, weblogic will adopt the default value.
The corresponding settings are reflected in weblogic console.