无法启动管理器:Apache Ignite .NET 中的 GridManagerAdapter
Failed to start manager : GridManagerAdapter in Apache Ignite .NET
我在 Windows 8.1 x64 和 Visual Studio 2015 环境中。我已经通过命令行 运行 获得了一个 Ignite 实例。此实例使用文件 default-config-gourab.xml
中的配置
我想使用 C# 连接到此实例。
Ignition.ClientMode = true;
using (var ignite = Ignition.Start(@"C:\Ignite\config\default-config-gourab.xml"));
我已确保将客户端模式开关设置为 true,并且指向相同的配置文件。但我仍然得到 IgniteException,这似乎是由于 GridManagerAdapter 未能启动。以下是堆栈跟踪:-
Apache.Ignite.Core.Common.IgniteException was unhandled
HResult=-2146233088
Message=Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
Source=Apache.Ignite.Core
StackTrace:
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
at Apache.Ignite.Core.Ignition.Start(String springCfgPath)
at IgniteTest.Program.IgniteCache() in C:\Users\gourab\documents\visual studio 2015\Projects\IgniteTest\IgniteTest\Program.cs:line 23
at IgniteTest.Program.Main(String[] args) in C:\Users\gourab\documents\visual studio 2015\Projects\IgniteTest\IgniteTest\Program.cs:line 15
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
以下是我的配置文件:-
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!--
Custom configuration copied from dotnet examples - Gourab
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<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>
<!-- In distributed environment, replace with actual host IP address. -->
<value>127.0.0.1:47500</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
<!-- Enable task execution events for examples. -->
<property name="includeEventTypes">
<list>
<!-- Task execution events -->
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
<!-- Job execution events -->
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_MAPPED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_RESULTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FAILED_OVER"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_STARTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FINISHED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_TIMEDOUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_REJECTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FAILED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_QUEUED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_CANCELLED"/>
</list>
</property>
</bean>
</beans>
原因是 .NET 中的 BinaryConfiguration 与 Java 默认值不匹配。
要解决此问题,请使用以下内容更新您的 Spring XML 配置:
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
<property name="compactFooter" value="true"/>
<property name="idMapper">
<bean class="org.apache.ignite.binary.BinaryBasicIdMapper">
<constructor-arg value="true"/>
</bean>
</property>
<property name="nameMapper">
<bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
<constructor-arg value="true"/>
</bean>
</property>
</bean>
</property>
我在 Windows 8.1 x64 和 Visual Studio 2015 环境中。我已经通过命令行 运行 获得了一个 Ignite 实例。此实例使用文件 default-config-gourab.xml
中的配置我想使用 C# 连接到此实例。
Ignition.ClientMode = true;
using (var ignite = Ignition.Start(@"C:\Ignite\config\default-config-gourab.xml"));
我已确保将客户端模式开关设置为 true,并且指向相同的配置文件。但我仍然得到 IgniteException,这似乎是由于 GridManagerAdapter 未能启动。以下是堆栈跟踪:-
Apache.Ignite.Core.Common.IgniteException was unhandled
HResult=-2146233088
Message=Failed to start manager: GridManagerAdapter [enabled=true, name=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager]
Source=Apache.Ignite.Core
StackTrace:
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, Void* errData, Int32 errDataLen)
at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.IgnitionStart(Void* ctx, SByte* cfgPath, SByte* gridName, Int32 factoryId, Int64 dataPtr)
at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.IgnitionStart(UnmanagedContext ctx, String cfgPath, String gridName, Boolean clientMode)
at Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
at Apache.Ignite.Core.Ignition.Start(String springCfgPath)
at IgniteTest.Program.IgniteCache() in C:\Users\gourab\documents\visual studio 2015\Projects\IgniteTest\IgniteTest\Program.cs:line 23
at IgniteTest.Program.Main(String[] args) in C:\Users\gourab\documents\visual studio 2015\Projects\IgniteTest\IgniteTest\Program.cs:line 15
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
以下是我的配置文件:-
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!--
Custom configuration copied from dotnet examples - Gourab
-->
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
<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>
<!-- In distributed environment, replace with actual host IP address. -->
<value>127.0.0.1:47500</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
<!-- Enable task execution events for examples. -->
<property name="includeEventTypes">
<list>
<!-- Task execution events -->
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
<!-- Job execution events -->
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_MAPPED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_RESULTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FAILED_OVER"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_STARTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FINISHED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_TIMEDOUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_REJECTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FAILED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_QUEUED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_CANCELLED"/>
</list>
</property>
</bean>
</beans>
原因是 .NET 中的 BinaryConfiguration 与 Java 默认值不匹配。 要解决此问题,请使用以下内容更新您的 Spring XML 配置:
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
<property name="compactFooter" value="true"/>
<property name="idMapper">
<bean class="org.apache.ignite.binary.BinaryBasicIdMapper">
<constructor-arg value="true"/>
</bean>
</property>
<property name="nameMapper">
<bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
<constructor-arg value="true"/>
</bean>
</property>
</bean>
</property>