OpenLiberty session-cache feature: A strange behavior is observed when using CDI beans with session scope in conjunction with the session-cache feature (with hazelcast provider) of OpenLiberty.
The observed behavior with CDI session beans is unusual: after modifying a property of the bean, then calling session.getAttributeNames() within the same method, the shared session cache is not updated. However, if session.getAttributeNames() is not called, everything works correctly and the cache is updated.
@SessionScoped
@Named ("test")
public class TestBean
{
private String test = "init";
public String process( HttpServletRequest request )
{
test= request.getParameter("test");
HttpSession session = request.getSession( true );
session.getAttributeNames(),
}
}
Do you have any hypotheses about what could be causing this behavior?
My server.xml
<featureManager>
<feature>servlet-6.0</feature>
<!-- tag::sessionCache[] -->
<feature>sessionCache-1.0</feature>
<!-- end::sessionCache[] -->
<feature>cdi-4.0</feature>
<feature>pages-3.1</feature>
<feature>mpConfig-3.1</feature>
</featureManager>
<variable name="http.port" defaultValue="9090"/>
<variable name="https.port" defaultValue="9453"/>
<variable name="app.context.root" defaultValue="test"/>
<httpEndpoint httpPort="${http.port}" httpsPort="${https.port}"
id="defaultHttpEndpoint" host="*" />
<!-- tag::httpSessionCache[] -->
<httpSessionCache libraryRef="jCacheVendorLib"
uri="file:${server.config.dir}/hazelcast-config.xml" writeContents=ALL_SESSION_ATTRIBUTES >
<!-- end::httpSessionCache[] -->
<!-- tag::library[] -->
<library id="jCacheVendorLib">
<!-- tag::hazelcastjar[] -->
<file name="${shared.resource.dir}/hazelcast-5.3.6.jar" />
<!-- end::hazelcastjar[] -->
</library>
<!-- end::library[] -->
<webApplication location="test.war" contextRoot="${app.context.root}" />