Two strange issues when using Apache Ignite.NET
Ignition.Start()
method is not picking the default config file path from {IGNITEHOME}/config/default-config.xml
instead using all system defaults.
Getting an error while specifying the default config file path but server start successfully without config file path (Ignition.Start()
).
Below is the simple code, logg and config file.
static void Main(string[] args)
{
Console.WriteLine("IGNITE_HOME=" + Environment.GetEnvironmentVariable("IGNITE_HOME"));
var ignite = Ignition.Start(@"C:/Apache/gridgain-community-8.8.16/config/default-config.xml");
//var ignite = Ignition.Start();
var cache = ignite.GetOrCreateCache<int, string>("my-cache");
cache.Put(1, "Hello, World");
Console.WriteLine(cache.Get(1));
}
The main error
[14:56:12,518][INFO][main][GridTcpRestProtocol] Command protocol successfully started [name=TCP binary, host=/127.0.0.1, port=11211]
[14:56:12,558][WARNING][main][PlatformProcessorImpl] Marshaller is automatically set to o.a.i.i.binary.BinaryMarshaller (other nodes must have the same marshaller type).
[14:56:12,606][SEVERE][main][IgniteKernal%Justin Local Grid] **Exception during start processors, node will be stopped and close connections
class org.apache.ignite.IgniteException: Invalid header on deserialization. Expected: 9 but was: 119**
at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackUtils.inLongLongLongObjectOutLong(Native Method)
at org.apache.ignite.internal.processors.platform.callback.PlatformCallbackGateway.onStart(PlatformCallbackGateway.java:837)
at org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.start(PlatformProcessorImpl.java:285)
at org.apache.ignite.internal.IgniteKernal.startProcessor(IgniteKernal.java:1908)
at org.apache.ignite.internal.IgniteKernal.start(IgniteKernal.java:1177)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start0(IgnitionEx.java:1784)
at org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance.start(IgnitionEx.java:1706)
at org.apache.ignite.internal.IgnitionEx.start0(IgnitionEx.java:1143)
at org.apache.ignite.internal.IgnitionEx.start(IgnitionEx.java:634)
at org.apache.ignite.internal.processors.platform.PlatformAbstractBootstrap.start(PlatformAbstractBootstrap.java:45)
Config file
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2019 GridGain Systems, Inc. and Contributors.
Licensed under the GridGain Community Edition License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!--
Alter configuration below as needed.
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="localHost" value="127.0.0.1"/>
<property name="gridName" value="Justin Local Grid"/>
<property name="workDirectory" value="C:\Apache\gridgain-community-8.8.16\work"/>
<property name="userAttributes">
<map>
<entry key="my_attr" value="value1"/>
</map>
</property>
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>127.0.0.1:47500..47509</value>
</list>
</property>
</bean>
</property>
<property name="socketTimeout" value="300" />
</bean>
</property>
</bean>
</beans>
Invalid header on deserialization
is caused by a mismatch between .NET and Java parts of Apache Ignite.
Do a clean rebuild (delete bin
and obj
directories from your project). Old jar files get stuck there sometimes when switching from Ignite to GridGain and/or between different versions of Ignite/GridGain.
IGNITE_HOME
environment variable is NOT needed when using Ignite.NET from NuGet, remove it from the system. It is needed only for custom deployments. See https://ignite.apache.org/docs/latest/net-specific/net-deployment-options#custom-deployment