0

I'm using Infinispan 10 and Wildfly 17. I have an infinispan.xml file with a white list of classes where I specify the marshaller:

<?xml version="1.0" encoding="UTF-8"?>
<infinispan xmlns="urn:infinispan:config:10.0">
    <cache-container>
        <serialization marshaller="org.infinispan.commons.marshall.JavaSerializationMarshaller">
            <white-list>
              <class>org.jsr107.ri.annotations.DefaultGeneratedCacheKey</class>              
              <regex>java.sql.*</regex>  
              <regex>java.util.*</regex>
            </white-list>            
        </serialization>
    </cache-container>
</infinispan>

I followed this documentation, chapter 9.1.2 Java Serialization Marshaller

But it doesn't seem to work for a specific class, which is org.jsr107.ri.annotations.DefaultGeneratedCacheKey. The error message is:

Cannot marshall 'class org.jsr107.ri.annotations.DefaultGeneratedCacheKey': java.lang.IllegalArgumentException: No marshaller registered for Java type org.jsr107.ri.annotations.DefaultGeneratedCacheKey

How can I add that class to Infinispan's white list?

More info:

I load the CacheManager at startup, like this:

ClassLoader classLoader = CacheSetup.class.getClassLoader()
URI uri = URI.create("infinispan.xml");
final CacheManager jCacheManager = Caching.getCachingProvider().getCacheManager(uri, classLoader);

The Infinispan dependencies in my pom.xml:

    <dependency>
        <groupId>org.jsr107.ri</groupId>
        <artifactId>cache-annotations-ri-cdi</artifactId>
        <version>1.1.1</version>
    </dependency>

<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-jcache</artifactId>
    <version>10.0.1.Final</version>
    <scope>runtime</scope>
</dependency>

<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-cdi-embedded</artifactId>
    <version>10.0.1.Final</version>
    <scope>runtime</scope>
</dependency>

In standalone.xml, this is all that I find related to Infinspan.

<subsystem xmlns="urn:jboss:domain:distributable-web:1.0" default-session-management="default" default-single-sign-on-management="default">
    <infinispan-session-management name="default" granularity="SESSION" cache-container="web">
        <primary-owner-affinity/>
    </infinispan-session-management>
    <infinispan-single-sign-on-management name="default" cache-container="web" cache="sso"/>
    <infinispan-routing cache-container="web" cache="routing"/>
</subsystem>

    <caches>
        <cache name="simple"/>
        <cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
    </caches>

    <passivation-stores>
        <passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
    </passivation-stores>

<subsystem xmlns="urn:jboss:domain:infinispan:8.0">
    <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
        <local-cache name="passivation">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
            <file-store passivation="true" purge="false"/>
        </local-cache>
        <local-cache name="sso">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
        </local-cache>
        <local-cache name="routing"/>
    </cache-container>
    <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
        <local-cache name="default">
            <transaction mode="BATCH"/>
        </local-cache>
    </cache-container>
    <cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
        <local-cache name="passivation">
            <locking isolation="REPEATABLE_READ"/>
            <transaction mode="BATCH"/>
            <file-store passivation="true" purge="false"/>
        </local-cache>
    </cache-container>
    <cache-container name="hibernate" module="org.infinispan.hibernate-cache">
        <local-cache name="entity">
            <object-memory size="10000"/>
            <expiration max-idle="100000"/>
        </local-cache>
        <local-cache name="local-query">
            <object-memory size="10000"/>
            <expiration max-idle="100000"/>
        </local-cache>
        <local-cache name="timestamps"/>
    </cache-container>
</subsystem>
4

1 に答える 1