我正在尝试使用Apache Ignite进行设置。
我有一个dotnet核心客户端应用程序,它试图获取缓存(ignite.GetCache<int, CacheThing>("test-cache")
或创建缓存('ignite.CreateCache')。
在两种情况下,结果都是相同的错误(请参见下文)。
我正在使用https://hub.docker.com/r/apacheignite/ignite/中的docker容器,并且正在使用apache/ignite:2.6.0
标签。
客户端正在尝试使用用于模式定义的自定义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客户端甚至有可能在Apache Ignite Java服务器中创建缓存吗?
答案 0 :(得分:1)
.NET缓存存储can not be deployed on Java-only node。
Docker容器包含仅Java的Ignite,您可以在C#代码中创建自定义缓存存储。
因此,除非Ignite团队发布运行Ignite.NET的Docker映像,否则您必须创建自定义Docker映像或以其他方式启动Ignite.NET服务器节点。