2016-03-17 10 views
0

我使用的是hazelcast-3.5.5和hazelcast-client - 3.5.5。根據文檔,它已在3.4.x中修復,但我仍然在3.5.5中遇到這個問題。沒有爲名稱空間註冊DataSerializerFactory:0 - hazelcast 3.5.5

這裏是我的代碼:

val hazelcastConfig = new XmlConfigBuilder(System.getProperty("hazelcast.config")).build() 
hazelcastConfig.setClassLoader(getClass.getClassLoader) 
config.getSerializationConfig().addSerializerConfig(sc); 
val instance :HazelcastInstance= Hazelcast.newHazelcastInstance(hazelcastConfig) 

下面是我hazelcast.xml

<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd" 
     xmlns="http://www.hazelcast.com/schema/config" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
<!--<group>--> 
    <!--<name>devtestme</name>--> 
    <!--<password>dev-passtestme</password>--> 
<!--</group>--> 
<!--<management-center enabled="false">http://localhost:3210/mancenter</management-center>--> 
<network> 
    <port auto-increment="false" port-count="100">5701</port> 
    <outbound-ports> 
     <!-- 
     Allowed port range when connecting to other nodes. 
     0 or * means use system provided port. 
     --> 
     <ports>0</ports> 
    </outbound-ports> 
    <join> 
     <multicast enabled="false"> 
      <multicast-group>224.2.2.3</multicast-group> 
      <multicast-port>54327</multicast-port> 
     </multicast> 
     <tcp-ip enabled="true"> 
      <member-list> 
       <member>myip1</member> 
       <member>myip2</member> 
      </member-list> 
      <!--<interface>myip1 </interface>--> 
     </tcp-ip> 
     <aws enabled="false"> 
      <access-key>my-access-key</access-key> 
      <secret-key>my-secret-key</secret-key> 
      <!--optional, default is us-east-1 --> 
      <region>us-west-1</region> 
      <!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property --> 
      <host-header>ec2.amazonaws.com</host-header> 
      <!-- optional, only instances belonging to this group will be discovered, default will try all running instances --> 
      <security-group-name>hazelcast-sg</security-group-name> 
      <tag-key>type</tag-key> 
      <tag-value>hz-nodes</tag-value> 
     </aws> 
    </join> 
    <!--<interfaces enabled="false">--> 
     <!--<interface>10.10.1.*</interface>--> 
    <!--</interfaces>--> 

</network> 

<map name="user_id"> 

    <map-store enabled="true"> 
     <!-- 
      Name of the class implementing MapLoader and/or MapStore. 
      The class should implement at least of these interfaces and 
      contain no-argument constructor. Note that the inner classes are not supported. 
     --> 
     <class-name>myclass</class-name> 
     <!-- 
      Number of seconds to delay to call the MapStore.store(key, value). 
      If the value is zero then it is write-through so MapStore.store(key, value) 
      will be called as soon as the entry is updated. 
      Otherwise it is write-behind so updates will be stored after write-delay-seconds 
      value by calling Hazelcast.storeAll(map). Default value is 0. 
     --> 
     <write-delay-seconds>0</write-delay-seconds> 
     <!-- 
      Used to create batch chunks when writing map store. 
      In default mode all entries will be tried to persist in one go. 
      To create batch chunks, minimum meaningful value for write-batch-size 
      is 2. For values smaller than 2, it works as in default mode. 
     --> 
     <write-batch-size>1</write-batch-size> 
    </map-store> 
</map> 
<map name="boolean_cache"> 

</map> 
<map name="inapp_templates"> 

    <map-store enabled="true"> 
     <!-- 
      Name of the class implementing MapLoader and/or MapStore. 
      The class should implement at least of these interfaces and 
      contain no-argument constructor. Note that the inner classes are not supported. 
     --> 
     <class-name>myclass</class-name> 
     <!-- 
      Number of seconds to delay to call the MapStore.store(key, value). 
      If the value is zero then it is write-through so MapStore.store(key, value) 
      will be called as soon as the entry is updated. 
      Otherwise it is write-behind so updates will be stored after write-delay-seconds 
      value by calling Hazelcast.storeAll(map). Default value is 0. 
     --> 
     <write-delay-seconds>0</write-delay-seconds> 
     <!-- 
      Used to create batch chunks when writing map store. 
      In default mode all entries will be tried to persist in one go. 
      To create batch chunks, minimum meaningful value for write-batch-size 
      is 2. For values smaller than 2, it works as in default mode. 
     --> 
     <write-batch-size>1</write-batch-size> 
     <!-- 
      Remove after the idle time 
     --> 
    </map-store> 
</map> 

下面是當我試圖連接至兩個,我發現了錯誤機器

WARNING: [ip]:7060 [devtestme] [3.5.5] hz._hzInstance_1_devtestme.IO.thread-in-1 Closing socket to endpoint null, Cause:com.hazelcast.nio.serialization.HazelcastSerializationException: No DataSerializerFactory registered for namespace: 0 
@4000000056e9be5d36796194 com.hazelcast.nio.serialization.HazelcastSerializationException: No DataSerializerFactory registered for namespace: 0 
@4000000056e9be5d36796194 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:98) 
@4000000056e9be5d3679d6c4 at com.hazelcast.nio.serialization.DataSerializer.read(DataSerializer.java:39) 
@4000000056e9be5d3679daac at com.hazelcast.nio.serialization.StreamSerializerAdapter.read(StreamSerializerAdapter.java:41) 

有人可以幫我解決這個問題,我花了很多時間在這個。提前致謝。

+0

你存儲的對象是什麼樣的? – noctarius

+0

我正在使用IMap [字符串,對象<>] – Temerario

+0

而你的對象是可序列化的?你能分享這個物體嗎?你的類路徑是什麼樣的?通常情況下,如果確實存在錯誤,但是肯定不是hazelcast.xml,則會出現此錯誤,因此請分享更多信息。 – noctarius

回答

0

我在我的build.sbt中有一個用於jackson庫的mergeStrategy。刪除它已解決了該問題。

+0

合併你是指類的「陰影」到JAR文件中嗎? PS:很高興你解決了:) – noctarius

相關問題