mavenwebsphere-libertysessioncontext

How to set shared-session-context true by default


I've a Maven EAR with some modules that need to share the session context. So when I run it on Liberty Server (on Eclipse) I've to add in the "Server Configuration" the application extension and set the shared-session-context flag to true.

I guess how can I set it by default, maybe in the pom.xml? I can find any information about it.

Thanks.


Solution

  • The recommended practice is to have in your source repo server.xml that is required for your application, and have all the required settings there. Then your maven build creates also Liberty server with your config and deploys app there.

    If you dont want to store that in the server config file, you can add ibm-application-ext.xml file to your EAR/META-INF folder, with shared session enabled like this:

    ibm-application-ext.xml contents:

    <?xml version="1.0" encoding="UTF-8"?>
    <application-ext xmlns="http://websphere.ibm.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-ext_1_1.xsd"
        version="1.1">
    
        <shared-session-context value="true"/>
    </application-ext>