Apache Ignite - NPE, когда клиент dotnet пытается создать кеш на сервере - PullRequest
0 голосов
/ 03 сентября 2018

Я пытаюсь выполнить настройку с помощью Apache Ignite. У меня есть клиентское приложение ядра dotnet, которое пытается либо получить кеш (ignite.GetCache<int, CacheThing>("test-cache")), либо создать кеш (ignite.CreateCache<int, CacheThing>).

В обоих случаях результатом является одна и та же ошибка (см. Ниже).

Apache Ignite Server

Я использую Docker-контейнер из https://hub.docker.com/r/apacheignite/ignite/, и использую тег apache/ignite:2.6.0.

Код клиента (dotnetcore)

Клиент пытается создать кэш, используя пользовательскую сборку ядра dotnet для определения схемы.

class Program
    {
        public static bool ClientDisconnected = false;

        static void Main(string[] args)
        {
            Console.WriteLine("Starting client");
            string x = typeof(CacheStoreFactory).FullName;
            Console.WriteLine("Cache factory: " + x);
            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = "ignite.config",
                JvmOptions = new[]
                {
                    "-Xdebug","-DIGNITE_QUIET=false"
                },
            };

            /*
            var cfg = new IgniteConfiguration()
            {
                ClientMode = true,
                JvmOptions = new[]
                {
                    "-Xdebug","-DIGNITE_QUIET=false"
                },
                BinaryConfiguration = new BinaryConfiguration
                {
                    Types = new List<string>
                    {
                        typeof(CacheStoreFactory).FullName,
                    }
                },
            };
             */


            Console.WriteLine("Ignite -> Start");
            using (IIgnite ignite = Ignition.Start(cfg))
            {
                Console.WriteLine("Destroy test-cache");


                //ignite.DestroyCache("test-cache");
                //ICache<int, CacheThing> cache = ignite.GetCache<int, CacheThing>("test-cache");


                ICache<int, CacheThing> cache = ignite.CreateCache<int, CacheThing>(new CacheConfiguration
                {
                    Name = "test-cache",
                    ReadThrough = true,
                    WriteThrough = true,
                    KeepBinaryInStore = true,
                    CacheStoreFactory = new CacheStoreFactory()
                });





                ignite.ClientDisconnected += (sender, eventArgs) =>
                {
                    ClientDisconnected = true;

                    Console.WriteLine("Client disconnected.");
                };

                ignite.ClientReconnected += (sender, eventArgs) =>
                {
                    ClientDisconnected = false;

                    Console.WriteLine("Client reconnected.");
                };

                Object retrieved = cache.Get(1);

                Console.WriteLine(retrieved);

                Console.WriteLine("Press enter to quit client");
                Console.ReadLine();
            }
        }
    }

Ошибка клиента

    at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.load(GridCacheStoreManagerAdapter.java:293)
    at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadAllFromStore(GridCacheStoreManagerAdapter.java:434)
    at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadAll(GridCacheStoreManagerAdapter.java:400)
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter$18.call(GridCacheAdapter.java:2046)
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter$18.call(GridCacheAdapter.java:2044)
    at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6695)
    at org.apache.ignite.internal.processors.closure.GridClosureProcessor$2.body(GridClosureProcessor.java:967)
    at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
    at org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore.doInvoke(PlatformDotNetCacheStore.java:469)
    at org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore.load(PlatformDotNetCacheStore.java:176)
    at org.apache.ignite.internal.processors.cache.CacheStoreBalancingWrapper.load(CacheStoreBalancingWrapper.java:98)
    at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadFromStore(GridCacheStoreManagerAdapter.java:327)
    ... 11 more
   --- End of inner exception stack trace ---
   at Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutLong[TR](Int32 type, Action`1 outAction, Func`3 inAction, Func`2 readErrorAction)
   at SpikeCD750.Program.Main(String[] args) in /home/anton/git/ignite-readthrough/SpikeCD750/Program.cs:line 85

Ошибка сервера

server_1  | [03:07:20,337][SEVERE][sys-#81][GridDhtAtomicCache] <test-cache> Failed processing get request: GridNearSingleGetRequest [futId=1535944038969, key=KeyCacheObjectImpl [part=1, val=1, hasValBytes=true], flags=1, topVer=AffinityTopologyVersion [topVer=6, minorTopVer=0], subjId=f91be4be-6ca6-4b70-8264-6dc5fee43357, taskNameHash=0, createTtl=-1, accessTtl=-1]
server_1  | class org.apache.ignite.IgniteCheckedException: java.lang.NullPointerException
server_1  |     at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadFromStore(GridCacheStoreManagerAdapter.java:338)
server_1  |     at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.load(GridCacheStoreManagerAdapter.java:293)
server_1  |     at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadAllFromStore(GridCacheStoreManagerAdapter.java:434)
server_1  |     at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadAll(GridCacheStoreManagerAdapter.java:400)
server_1  |     at org.apache.ignite.internal.processors.cache.GridCacheAdapter$18.call(GridCacheAdapter.java:2046)
server_1  |     at org.apache.ignite.internal.processors.cache.GridCacheAdapter$18.call(GridCacheAdapter.java:2044)
server_1  |     at org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6695)
server_1  |     at org.apache.ignite.internal.processors.closure.GridClosureProcessor$2.body(GridClosureProcessor.java:967)
server_1  |     at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
server_1  |     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
server_1  |     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
server_1  |     at java.lang.Thread.run(Thread.java:748)
server_1  | Caused by: javax.cache.integration.CacheLoaderException: java.lang.NullPointerException
server_1  |     ... 12 more
server_1  | Caused by: java.lang.NullPointerException
server_1  |     at org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore.doInvoke(PlatformDotNetCacheStore.java:469)
server_1  |     at org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore.load(PlatformDotNetCacheStore.java:176)
server_1  |     at org.apache.ignite.internal.processors.cache.CacheStoreBalancingWrapper.load(CacheStoreBalancingWrapper.java:98)
server_1  |     at org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter.loadFromStore(GridCacheStoreManagerAdapter.java:327)
server_1  |     ... 11 more

Возможно ли даже для клиента dotnet создать кеш на Java-сервере Apache Ignite?

1 Ответ

0 голосов
/ 03 сентября 2018

.NET Cache Store не может быть развернут на узле только Java .

Контейнер Docker содержит Ignite только для Java, и вы создаете собственное Cache Store в своем коде C #.

Таким образом, если команда Ignite не выпустит образ Docker под управлением Ignite.NET, вам придется создать собственный образ Docker или запустить серверные узлы Ignite.NET другим способом.

...