Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-14605

ContinuousQuery fails in java thick client when .NET custom logger is used

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Blocker
    • Resolution: Unresolved
    • 2.10, 2.9.1
    • None
    • cache, clients
    • None
    • Ignite running on Windows 10.

    Description

      The ContinuousQuery fails with a ClassNotFoundException in the following scenario:

      • Use .NET services in the cluster.
      • The .NET ignite configuration uses a custom logger.  <= this seems to be the root cause
      • Define a .NET class.
      • Register the class with the Ignite binary name mapper.
      • Start a java thick client.
      • Define the same type in java and register it with the binary name mapper.
      • Set up a continuous query for a cache.
      • Put an instance of the java class on the cache.
      • This triggers the ClassNotFoundException.

      Here is the .NET code:

            static void Main(string[] args)
            {
                  IgniteConfiguration cfg = new IgniteConfiguration();
                  cfg.BinaryConfiguration = new Apache.Ignite.Core.Binary.BinaryConfiguration()
                  {
                      NameMapper = new BinaryBasicNameMapper() { IsSimpleName = true }
                  };
                  cfg.Logger = new SampleLogger();  //comment this out for the ContinousQuery to work
                  IIgnite ignite = Ignition.Start(cfg);
                  ignite.GetCluster().SetActive(true);
                  ignite.GetBinary().GetBinaryType(typeof(TestDto));
                  Console.ReadLine();
              }
      
          public class SampleLogger : ILogger
          {
              public bool IsEnabled(LogLevel level)
              {
                  return true;
              }
              public void Log(LogLevel level, string message, object[] args, IFormatProvider formatProvider, string category, string nativeErrorInfo, Exception ex)
              {
                  Console.WriteLine(message);
              }
          }
      

      Here is the Java code:

              BinaryConfiguration binCfg = new BinaryConfiguration();
              BinaryBasicNameMapper namemapper = new BinaryBasicNameMapper();
              namemapper.setSimpleName(true);
              binCfg.setNameMapper(namemapper);
              IgniteConfiguration cfg = new IgniteConfiguration().setBinaryConfiguration(binCfg);
              cfg.setClientMode(true);
      
              Ignite ignite = Ignition.start(cfg);
              ignite.binary().toBinary(new TestDto());
              IgniteCache<Long, TestDto> testCache = ignite.getOrCreateCache("testcache2");
      
              //setup a query to get updates
              ContinuousQuery<Long, TestDto> query2 = new ContinuousQuery<>();
              query2.setLocalListener(new CacheEntryUpdatedListener<Long, TestDto>() {
              @Override
              public void onUpdated(Iterable<CacheEntryEvent<? extends Long, ? extends TestDto>> events)
                      throws CacheEntryListenerException {
                      // react to the update events here
                                  events.forEach(event -> {
                                      TestDto test = (TestDto)event.getValue();
                      });
                  }
              });
      
              testCache.query(query2);
              TestDto t = new TestDto();
              t.Value = "value";
              testCache.put(1l, t);
      

      Here is the exception:

      Exception in thread "main" org.apache.ignite.cache.CachePartialUpdateException: Failed to update keys (retry update if possible).: [1] at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1245) at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.cacheException(IgniteCacheProxyImpl.java:2083) at org.apache.ignite.internal.processors.cache.IgniteCacheProxyImpl.put(IgniteCacheProxyImpl.java:1319) at org.apache.ignite.internal.processors.cache.GatewayProtectedCacheProxy.put(GatewayProtectedCacheProxy.java:856) at itron.Program.main(Program.java:95) Caused by: class org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException: Failed to update keys (retry update if possible).: [1] at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicAbstractUpdateFuture.onPrimaryError(GridNearAtomicAbstractUpdateFuture.java:407) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicSingleUpdateFuture.onPrimaryResponse(GridNearAtomicSingleUpdateFuture.java:253) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateResponse(GridDhtAtomicCache.java:3311) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.access$500(GridDhtAtomicCache.java:146) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:306) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$6.apply(GridDhtAtomicCache.java:301) at org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1142) at org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:591) at org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:392) at org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:318) at org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$100(GridCacheIoManager.java:109) at org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:308) at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1908) at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1529) at org.apache.ignite.internal.managers.communication.GridIoManager.access$5300(GridIoManager.java:242) at org.apache.ignite.internal.managers.communication.GridIoManager$9.execute(GridIoManager.java:1422) at org.apache.ignite.internal.managers.communication.TraceRunnable.run(TraceRunnable.java:55) at org.apache.ignite.internal.util.StripedExecutor$Stripe.body(StripedExecutor.java:569) at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120) at java.base/java.lang.Thread.run(Thread.java:834) Suppressed: class org.apache.ignite.IgniteCheckedException: Failed to update keys on primary node. at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.UpdateErrors.addFailedKeys(UpdateErrors.java:124) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridNearAtomicUpdateResponse.addFailedKeys(GridNearAtomicUpdateResponse.java:340) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAtomicCache.java:2016) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal(GridDhtAtomicCache.java:1724) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.processNearAtomicUpdateRequest(GridDhtAtomicCache.java:3293) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.access$400(GridDhtAtomicCache.java:146) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:287) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$5.apply(GridDhtAtomicCache.java:282) ... 14 more Suppressed: class org.apache.ignite.binary.BinaryInvalidTypeException: platform.integrationservice.models.TestDto at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:717) at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1762) at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1721) at org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:820) at org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:150) at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:197) at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:76) at org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinaryIfNeeded(CacheObjectContext.java:138) at org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent.getValue(CacheContinuousQueryEvent.java:73) at org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEvent.toString(CacheContinuousQueryEvent.java:104) at java.base/java.lang.String.valueOf(String.java:2951) at java.base/java.lang.StringBuilder.append(StringBuilder.java:168) at org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryHandler$2.onEntryUpdated(CacheContinuousQueryHandler.java:449) at org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryManager.onEntryUpdated(CacheContinuousQueryManager.java:447) at org.apache.ignite.internal.processors.cache.GridCacheMapEntry.innerUpdate(GridCacheMapEntry.java:2513) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateSingle(GridDhtAtomicCache.java:2654) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.update(GridDhtAtomicCache.java:2114) at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.updateAllAsyncInternal0(GridDhtAtomicCache.java:1931) ... 19 more Caused by: java.lang.ClassNotFoundException: platform.integrationservice.models.TestDto at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:398) at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:9014) at org.apache.ignite.internal.util.IgniteUtils.forName(IgniteUtils.java:8957) at org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:376) at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:693)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            tkring Tom Kring
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: