没有为名称空间注册DataSerializerFactory:0 - hazelcast 3.5.5

时间:2016-03-17 03:47:34

标签: deserialization hazelcast hazelcast-imap

我正在使用hazelcast- 3.5.5和hazelcast-client - 3.5.5。根据它在3.4.x中修复的文档,但我仍然在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)

有人可以帮我解决这个问题,我花了很多时间来解决这个问题。提前谢谢。

1 个答案:

答案 0 :(得分:0)

我的build.sbt中有一个jackst库的mergeStrategy。删除它已解决了这个问题。