WildFly 24.0.1.Final / Bootable Jar 5.0.2.Final / Infinispan Server 13.0.6.Final
layers: web-server, web-clustering, logging
Very simple war project with 1 servlet that prints the session id and host on the screen.
Project name: SessionHotRod
WAR name: SessionHotRod.war
Bootable jar name: SessionHotRod-bootable.jar
distributable-web.xml:
<distributable-web xmlns="urn:jboss:distributable-web:2.0">
<session-management name="hotrodSM"/>
</distributable-web>
web.xml:
<web-app id="WebApp_ID" version="3.1" …. >
<distributable/>
</web-app>
standalone.xml:
<subsystem xmlns="urn:jboss:domain:distributable-web:2.0" default-session-management="default" default-single-sign-on-management="default">
<infinispan-session-management name="default" cache-container="web" granularity="SESSION">
<primary-owner-affinity/>
</infinispan-session-management>
<hotrod-session-management name="hotrodSM" remote-cache-container="sessionCache" granularity="SESSION">
<no-affinity/>
</hotrod-session-management>
<infinispan-single-sign-on-management name="default" cache-container="web" cache="sso"/>
<infinispan-routing cache-container="web" cache="routing"/>
</subsystem>
<subsystem xmlns="urn:jboss:domain:infinispan:13.0">
<cache-container name="web" default-cache="dist" marshaller="PROTOSTREAM" modules="org.wildfly.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<replicated-cache name="sso">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<expiration interval="0"/>
</replicated-cache>
<replicated-cache name="routing">
<expiration interval="0"/>
</replicated-cache>
<distributed-cache name="dist">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<expiration interval="0"/>
<file-store/>
</distributed-cache>
</cache-container>
<remote-cache-container name="sessionCache" default-remote-cluster="infinispan-server-cluster" modules="org.wildfly.clustering.web.hotrod">
<property name="infinispan.client.hotrod.auth_username">admin</property>
<property name="infinispan.client.hotrod.auth_password">secret</property>
<remote-clusters>
<remote-cluster name="infinispan-server-cluster" socket-bindings="infinispan-server-1"/>
</remote-clusters>
</remote-cache-container>
</subsystem>
I'm a bit unsure if I have to set configurations for Encoding & Marshalling or are there some default out of the box configurations.
I had a look at the example:
http://www.mastertheboss.com/jboss-frameworks/infinispan/how-to-externalize-http-sessions-on-infinispan/ and cannot see that anything specific gets configured w.r.t encoding and marshalling. (Is this a good example?)
When I startup my application, I see the following 2 warnings in the logs:
13:26:57,294 WARN [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 15) WFLYCLINF0033: Attribute 'marshaller' is configured to use a deprecated value: LEGACY; use one of the following values instead: [JBOSS, PROTOSTREAM]
13:27:00,772 WARN [org.infinispan.HOTROD] (HotRod-client-async-pool-0) ISPN004005: Error received from the server: org.infinispan.server.hotrod.CacheNotFoundException: Cache with name 'SessionHotRod.war' not found amongst the configured caches
For the first warning I've changed the remote-cache-container config and added marshaller="PROTOSTREAM"
<remote-cache-container name="sessionCache" default-remote-cluster="infinispan-server-cluster" marshaller="PROTOSTREAM" modules="org.wildfly.clustering.web.hotrod">
After I ran my TestServlet, when navigating to the Infinispan Admin Console, I can see the SessionHotRod.war cache. Now if I want to see what is in my cache, surely I have to make some changes to the Encoding/Marshalling configs to be able to see what is inside the cache?
This cache either has no encoding configuration or uses an encoding that the console does not support. You must use HotRod clients to perform read and write operations on this cache.
When I try to navigate into the cahce, I get the following message on the console:
and I get the following message in the Infinispan server logs:
WARN (blocking-thread--p3-t4) [org.infinispan.encoding.impl.StorageConfigurationManager] ISPN000599: Configuration for cache 'SessionHotRod.war' does not define the encoding for keys or values. If you use operations that require data conversion or queries, you should configure the cache with a specific MediaType for keys or values.
So does this mean you cannot see from the Infinispan Admin Consle what is in your cache when externalizing HttpSession to a remote Infinispan Server? I do understand that the console also needs to know how to unmarshal the HttpSession in order to show what is in the cache. Is this possible?
[I have added a cache template in the Infinispan.xml that has the media-type application/x-protostream for both the key and the value and changed my hotrod-session-management configuration to use this template
Now when navigating into the cache on the Admin Console , I get Invalid wire type 6 in tag 30]