无法启动管理器:Apache Ignite .NET中的GridManagerAdapter

时间:2016-06-07 11:07:37

标签: c# caching ignite

我使用的是Windows 8.1 x64和Visual Studio 2015环境。我有一个已经通过命令行运行的Ignite实例。此实例使用文件default-config-gourab.xml

中的配置

Ignite instance

我想使用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>

1 个答案:

答案 0 :(得分:0)

原因是.NET和Java默认值中的BinaryConfiguration不匹配。 要解决此问题,请使用以下命令更新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>