cachingmarshallinginfinispanhot-rod

Infinispan server cache change encoding 'application/x-jboss-marshalling' to 'application/x-protostream'


I am currently configured my cache container in JBoss 7.4 standalone.xml, and the ISPN remote server running on localhost. Everything was fine until it throws the error:

ISPN000492: Cannot find transcoder between 'application/x-jboss-marshalling' to 'application/x-protostream'

standalone.xml:

         <remote-cache-container name="remoteContainer" default-remote-cluster="data-grid-cluster">
            <property name="infinispan.client.hotrod.sasl_mechanism">SCRAM-SHA-512</property>
            <property name="infinispan.client.hotrod.auth_realm">default</property>
            <property name="infinispan.client.hotrod.auth_username">admin</property>
            <property name="infinispan.client.hotrod.auth_password">12345</property>
            <property name="infinispan.client.hotrod.client_intelligence">BASIC</property>
            <remote-clusters>
                <remote-cluster name="data-grid-cluster" socket-bindings="ispn1 ispn2"/>
            </remote-clusters>
        </remote-cache-container>

ISPN Cache configuration:

{ "distributed-cache": { "mode": "SYNC", "owners": 2, "encoding": { "key": { "media-type": "application/x-protostream" }, "value": { "media-type": "application/x-protostream" } }, "expiration": { "lifespan": 5000, "max-idle": 1000 }, "statistics": true } }

Note: I don't want to change the cache encoding because the infinispan web console stops working


Solution

  • The error is saying the client cache has media type application/x-jboss-marshalling, and you want application/x-protostream instead.

    Looking at the WildFly 23.x code, it will use ProtoStreamMarshaller (and media type application/x-protostream) iff the application has a SerializationContextInitializer implementation in its classpath.

    Even if you only store strings and primitives in the cache, you still have to write an interface and annotate it with @AutoProtoSchemaBuilder for RemoteCacheContainerConfigurationServiceConfigurator to choose ProtoStreamMarshaller.

    In WildFly 24.x the auto-detection mechanism changes, and ProtoStreamMarshaller is picked if the modules attribute includes org.wildfly.clustering.web.hotrod, so <remote-cache-container modules="org.wildfly.clustering.web.hotrod"> might also work on 23.x.

    In Wildfly 24.x you can always set <remote-cache-container marshaller="PROTOSTREAM"> to choose ProtoStreamMarshaller manually.