Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-12796

SerializableBiFunction fails to deserialize on replicated cache

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 11.0.4.Final, 12.0.1.Final
    • None
    • Hide

      Define a replicated cache in Wildfly v.21. 

      <replicated-cache name="opencell-running-jobs" statistics-enabled="true"/>

       

      Call cache.compute() with any SerializableBiFunction defined in your application class.

       

      public class JobCacheContainerProvider implements Serializable {

          @Resource(lookup = "java:jboss/infinispan/cache/opencell/opencell-running-jobs")
          private Cache<CacheKeyLong, JobExecutionStatus> runningJobsCache;

          public void addUpdateJobInstance(JobInstance jobInstance) {

          SerializableBiFunction<? super CacheKeyLong, JobExecutionStatus, JobExecutionStatus> remappingFunction = (jobInstIdFullKey, jobExecutionStatusOld) -> {

              if (jobExecutionStatusOld != null)

      {             return jobExecutionStatusOld;        }

      else

      {             return new JobExecutionStatus(jobInstance.getId(), jobInstance.getCode());        }

          };

          runningJobsCache.compute(new CacheKeyLong(currentUser.getProviderCode(), jobInstance.getId()), remappingFunction);

      }

       

       

       

      Show
      Define a replicated cache in Wildfly v.21.  <replicated-cache name="opencell-running-jobs" statistics-enabled="true"/>   Call cache.compute() with any SerializableBiFunction defined in your application class.   public class JobCacheContainerProvider implements Serializable {     @Resource(lookup = "java:jboss/infinispan/cache/opencell/opencell-running-jobs")     private Cache<CacheKeyLong, JobExecutionStatus> runningJobsCache;     public void addUpdateJobInstance(JobInstance jobInstance) {     SerializableBiFunction<? super CacheKeyLong, JobExecutionStatus, JobExecutionStatus> remappingFunction = (jobInstIdFullKey, jobExecutionStatusOld) -> {         if (jobExecutionStatusOld != null) {             return jobExecutionStatusOld;        } else {             return new JobExecutionStatus(jobInstance.getId(), jobInstance.getCode());        }     };     runningJobsCache.compute(new CacheKeyLong(currentUser.getProviderCode(), jobInstance.getId()), remappingFunction); }      
    • Undefined
    • 66422735

      Running wildfly v.21 on a cluster with replicated cache. Standard standalone-full-ha.xml configuration with replicated cache. 

      JAVA: OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

      Cache.compute() fails to deserialize a lambda function because of class not found exception. (does not find a class from my deployed application) 

      On Wildlfy v.18 cache.compute() was working fine, but on Widlfly v.21 same code gives an error that lambda function can not de deserialized on a node because JobCacheContainerProvider class not found in org.jboss.as.clustering.infinispan module. org.jboss.as.clustering.infinispan is a default value for a module attribute in Wildlfy's cache container definition.

      Any suggestions how to use cache.compute() without having to create a module just for lambda function definitions. Or how to specify a currently loaded application as a module.

      Exception thrown:

      Caused by: java.lang.ClassNotFoundException: org.meveo.cache.JobCacheContainerProvider from [Module "org.jboss.as.clustering.infinispan" version 22.0.1.Final from local module loader @252dc8c4 (finder: local module finder @43045f9f (roots: C:\andrius\programs\wildfly-22.0.1.Final\modules,C:\andrius\programs\wildfly-22.0.1.Final\modules\system\layers\base,C:\andrius\programs\wildfly-22.0.1.Final\modules\system\add-ons\keycloak))]
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
              at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
              at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
              at org.infinispan@11.0.8.Final//org.infinispan.marshall.exts.ThrowableExternalizer.readGenericThrowable(ThrowableExternalizer.java:282)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.exts.ThrowableExternalizer.readObject(ThrowableExternalizer.java:259)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.exts.ThrowableExternalizer.readObject(ThrowableExternalizer.java:42)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.readWithExternalizer(GlobalMarshaller.java:728)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.readNonNullableObject(GlobalMarshaller.java:709)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.readNullableObject(GlobalMarshaller.java:358)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.BytesObjectInput.readObject(BytesObjectInput.java:32)        at org.infinispan@11.0.8.Final//org.infinispan.remoting.responses.ExceptionResponse$Externalizer.readObject(ExceptionResponse.java:49)        at org.infinispan@11.0.8.Final//org.infinispan.remoting.responses.ExceptionResponse$Externalizer.readObject(ExceptionResponse.java:41)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.readWithExternalizer(GlobalMarshaller.java:728)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.readNonNullableObject(GlobalMarshaller.java:709)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.readNullableObject(GlobalMarshaller.java:358)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.objectFromObjectInput(GlobalMarshaller.java:192)        at org.infinispan@11.0.8.Final//org.infinispan.marshall.core.GlobalMarshaller.objectFromByteBuffer(GlobalMarshaller.java:221)        at org.infinispan@11.0.8.Final//org.infinispan.remoting.transport.jgroups.JGroupsTransport.processResponse(JGroupsTransport.java:1394)}}
      

       

              Unassigned Unassigned
              andrius.karpavicius Andrius Karpavicius (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: