2016-06-07 308 views
1

我在Windows的x64 8.1和Visual Studio 2015年環境。我有一個Ignite實例已經通過命令行運行。這個實例使用從文件默認配置 - gourab.xml無法啓動管理器:GridManagerAdapter在Apache中點燃.NET

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> 

回答

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> 
+0

這適用於我。非常感謝 –