Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-16257

Injected PROTOSTREAM cache doesn't want to add entries

XMLWordPrintable

      I defined a replicated cache in standalone-full-ha.xml, and I inject and use this cache in my code like follows, which is a PROTOSTREAM cache:

       

      package za.co.company;
      import org.jboss.ejb3.annotation.TransactionTimeout;
      import za.co.company.Author;
      import javax.annotation.Resource;
      import javax.ejb.*;
      import java.util.Map;
      import java.util.concurrent.TimeUnit;
      @Singleton
      @Startup
      @ConcurrencyManagement(ConcurrencyManagementType.BEAN)
      @AccessTimeout(value = 1, unit = TimeUnit.HOURS)
      @TransactionTimeout(value = 1, unit = TimeUnit.HOURS)
      public class BookCache {
          @Resource(lookup="java:jboss/infinispan/cache/company/author")
          private Map<String, Author> cache2;
          @Schedule(hour = "*", minute = "*/1", persistent = false)
          void testCache() {
              cache2.put("entry1", new Author("Johan", "Steenkamp"));
          }
      }
      

       

      However, when getting to cache2.put, I get the following exception:

       

      Caused by: org.infinispan.commons.marshall.MarshallingException: ISPN000615: Unable to unmarshall 'za.co.company.Author' as a marshaller is not present in the user or global SerializationContext
          at org.infinispan@12.1.7.final//org.infinispan.encoding.protostreamtranscoder.getctxformarshalling(protostreamtranscoder.java:198)
          at org.infinispan@12.1.7.final//org.infinispan.encoding.protostreamtranscoder.marshall(protostreamtranscoder.java:127)
          at org.infinispan@12.1.7.final//org.infinispan.encoding.protostreamtranscoder.transcode(protostreamtranscoder.java:68)
          at org.infinispan@12.1.7.final//org.infinispan.encoding.dataconversion.tostorage(dataconversion.java:227)
          at org.infinispan@12.1.7.final//org.infinispan.cache.impl.encodercache.valuetostorage(encodercache.java:105)
          at org.infinispan@12.1.7.final//org.infinispan.cache.impl.encodercache.put(encodercache.java:698)
          at org.infinispan@12.1.7.final//org.infinispan.cache.impl.abstractdelegatingcache.put(abstractdelegatingcache.java:449)
          at deployment.Company.war//za.co.company.BookCache.testCache(BookCache.java:22)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImp
       
      

      I have done proper registration of my Initializer, which I have detailed this in this Stackoverflow post:

      https://stackoverflow.com/questions/71840371/getting-exception-when-trying-to-add-entry-to-protostream-based-cache-in-wildfly

      Also, as I have described in above mentioned StackOverflow post, I debugged through some some of the Infinispan/Wildfly sourcecode, and I am convinced that this is a bug.

       

       

            pferraro@redhat.com Paul Ferraro
            jj.steenkamp Johan Steenkmap (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: