Search code examples
.netignite

Apache Ignite .Net Error: IgniteException: No matching type found for object


I started a server and a client. server code:

private readonly IMessaging messaging;
public CacheEventListener(IMessaging messaging)
{
    this.messaging = messaging;
}
public bool Invoke(CacheEvent evt)
{
    Console.WriteLine("Send Massage" + evt);
    messaging.Send(evt, "Expired");
    return true;
}

Client code:

    QueryEntity query = new QueryEntity(typeof(SupplierInfo));
    var test = new CacheConfiguration("YYYYY", query)
    {
        ExpiryPolicyFactory = new ExpiryPolicyFactorylmp(expiryPolicy)
    };
    var cache2 = client.GetOrCreateCache<int, SupplierInfo>(test);
    var sp = new SupplierInfo()
    {
        Id = Guid.NewGuid(),
        CreditCode = "222",
        LogoUrl = "222",
        CompanyName = "222",
        CompanyShortName = "222",
        CompanyShortCode = "222",
        CompanyPhone = "222",
        ContactName = "222",
        ContactPhone = "222",
        CompanyOverview = "222",
        RentalExpenses = 2,
        TotalNumber = 2,
        IsTestData = 2,
        Version = 2,
        IsDeleted = false,
        CreatedUserId = Guid.NewGuid(),
        CreatedUserName = "Admin",
        CreatedTime = DateTime.UtcNow,
        UpdateTime = DateTime.UtcNow
    };
    cache2.Put(8, sp);

now,The server prompts an exception.

class org.apache.ignite.IgniteException: No matching type found for object [typeId=1288100364, typeName=IgniteTest.SupplierInfo]. This usually indicates that assembly with specified type is not loaded on a node. When using Apache.Ignite.exe, make sure to load assemblies with -assembly parameter. Alternatively, set IgniteConfiguration.PeerAssemblyLoadingMode to CurrentAppDomain.

I tried to configure IgniteConfiguration and fixed PeerAssemblyLoadingMode = CurrentAppDomain for both the client and the server, but I still fail to solve it. Has anyone ever solved it with any resolution?

The full trace is:

[16:58:50,720][SEVERE][ttl-cleanup-worker-#43%ignite-instance-4deb7316-fb9e-48bf-a581-a429438de5d5%][GridEventStorageManager] **Unexpected exception in listener notification for event: CacheEvent** [cacheName=YYYYY, part=8, key=8, xid=null, txLbl=null, lockId=null, newVal=null, oldVal=IgniteTest.SupplierInfo [idHash=1510571490, hash=-355695424, CompanyShortName=222, CreditCode=222, IsTestData=2, CreatedUserId=3160af90-4aea-46a3-bfb4-2826f09843a0, IsDeleted=false, CreatedTime=2020-08-27 16:58:44.7298304, CreatedUserName=Admin, LogoUrl=222, CompanyShortCode=222, CompanyOverview=222, ContactPhone=222, CompanyName=222, Version=2, TotalNumber=2, UpdateTime=System.DateTime [idHash=2142918651, hash=1220622086, dateData=5249027173674686823, ticks=637341155247298919], Id=706d44ca-fb60-4c9e-a8b4-03097b1dbc96, RentalExpenses=2, ContactName=222, CompanyPhone=222], hasOldVal=true, hasNewVal=false, near=false, subjId=null, cloClsName=null, taskName=null, nodeId8=ceb978cc, evtNodeId8=ceb978cc, msg=Cache event., type=CACHE_OBJECT_EXPIRED, tstamp=1598518730398]
class org.apache.ignite.IgniteException: No matching type found for object [typeId=1288100364, typeName=IgniteTest.SupplierInfo]. This usually indicates that assembly with specified type is not loaded on a node. When using Apache.Ignite.exe, make sure to load assemblies with -assembly parameter. Alternatively, set IgniteConfiguration.PeerAssemblyLoadingMode to CurrentAppDomain.
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.inLongLongLongObjectOutLong(Native Method)
        at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.eventFilterApply(PlatformCallbackGateway.java:741)
        at org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl.apply0(PlatformEventFilterListenerImpl.java:136)
        at org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl.apply(PlatformEventFilterListenerImpl.java:93)
        at org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl.apply(PlatformEventFilterListenerImpl.java:38)
        at org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager$UserListenerWrapper.onEvent(GridEventStorageManager.java:1484)
        at org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.notifyListeners(GridEventStorageManager.java:886)
        at org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.notifyListeners(GridEventStorageManager.java:871)
        at org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.record0(GridEventStorageManager.java:346)
        at org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.record(GridEventStorageManager.java:299)
        at org.apache.ignite.internal.processors.cache.GridCacheEventManager.addEvent(GridCacheEventManager.java:342)
        at org.apache.ignite.internal.processors.cache.GridCacheEventManager.addEvent(GridCacheEventManager.java:242)
        at org.apache.ignite.internal.processors.cache.GridCacheMapEntry.onExpired(GridCacheMapEntry.java:4097)
        at org.apache.ignite.internal.processors.cache.GridCacheMapEntry.onTtlExpired(GridCacheMapEntry.java:4019)
        at org.apache.ignite.internal.processors.cache.GridCacheTtlManager$1.applyx(GridCacheTtlManager.java:76)
        at org.apache.ignite.internal.processors.cache.GridCacheTtlManager$1.applyx(GridCacheTtlManager.java:67)
        at org.apache.ignite.internal.util.lang.IgniteInClosure2X.apply(IgniteInClosure2X.java:38)
        at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager$GridCacheDataStore.purgeExpiredInternal(GridCacheOffheapManager.java:2727)
        at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager$GridCacheDataStore.purgeExpired(GridCacheOffheapManager.java:2653)
        at org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager.expire(GridCacheOffheapManager.java:1048)
        at org.apache.ignite.internal.processors.cache.GridCacheTtlManager.expire(GridCacheTtlManager.java:243)
        at org.apache.ignite.internal.processors.cache.GridCacheSharedTtlCleanupManager$CleanupWorker.lambda$body$0(GridCacheSharedTtlCleanupManager.java:179)
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfPresent(ConcurrentHashMap.java:1828)
        at org.apache.ignite.internal.processors.cache.GridCacheSharedTtlCleanupManager$CleanupWorker.body(GridCacheSharedTtlCleanupManager.java:178)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at java.base/java.lang.Thread.run(Thread.java:832)
Send MassageCacheEvent [Name=CACHE_OBJECT_EXPIRED, Type=70, Timestamp=08/27/2020 08:58:50, Message=Cache event.]
Send MassageCacheEvent [Name=CACHE_OBJECT_EXPIRED, Type=70, Timestamp=08/27/2020 08:58:50, Message=Cache event.]
Send MassageCacheEvent [Name=CACHE_OBJECT_EXPIRED, Type=70, Timestamp=08/27/2020 08:58:50, Message=Cache event.]
Send MassageCacheEvent [Name=CACHE_OBJECT_EXPIRED, Type=70, Timestamp=08/27/2020 08:58:50, Message=Cache event.]

Solution

  • The server does not know how to deserialize the SupplierInfo object.

    Make sure this class exists on the server side, and add the class to the BinaryConfiguration:

    var serverCfg = new IgniteConfiguration
    {
        ...
        BinaryConfiguration = new BinaryConfiguration(typeof(SupplierInfo))
        ...
    };
    

    EDIT Alternatively, just make sure that SupplierInfo and any other type that is cached is available on the server - the assembly with types should be referenced on the server side.