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

No DataSerializerFactory registered for namespace: 0 - hazelcast 3.5.5

我正在使用 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)

有人可以帮我解决这个问题吗,我在这上面花了很多时间。提前致谢。

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