Search code examples
deploymentwebspheresession-management

Override session management via deployment descriptor


We have a WebSphere Application Server 6.1. Session management is configured with replication and timeout etc... (the obvious).

An new project needs some other settings for session management (longer timeout, no replication necessary). There is a check box in the WebSphere Admin Console:

Enterprise Application > appname > Session management > Override Session management

Then the settings in the deployment descriptor are the valid ones. Only proplem is, that is not checked by default and there is no option during deployment to give that information to WebSphere. So our scripted deployment fails to check that and a human has to do it.

Is there another way to do this? Maybe via something in the deployment descriptor?


Solution

  • OK, took me sometime but here is the solution in Jython:

    deployedApplication = AdminConfig.getid('/Deployment:<appname>/')
    deployedObject = AdminConfig.showAttribute(deployedApplication, 'deployedObject')
    
    sessionMgrAttrs = [['sessionManagement', [['enable', 'true']]]]
    
    AdminConfig.create('ApplicationConfig', deployedObject, sessionMgrAttrs)
    AdminConfig.save()
    

    That checks the check box I mentioned via a script (Don't forget to sync to the nodes after that).