此文件自 8 个月以来一直没有更改,今天我们在 hz:client 属性上遇到了与以下相关的错误:
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict,
but no declaration can be found for element 'hz:client'.
- schema_reference.4: Failed to read schema document
'https://hazelcast.com/schema/spring/hazelcast-spring-3.7.xsd',
because 1) could not find the document; 2) the document could
not be read; 3) the root element of the document is not
<xsd:schema>.
当我检查这个https://hazelcast.com/schema/spring/hazelcast-spring-3.7.xsd时模式在那里,但里面的元素以 xs 标签开头。 我该如何解决此问题或重写客户端配置?
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.hazelcast.com/schema/spring https://hazelcast.com/schema/spring/hazelcast-spring-3.6.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-interation-2.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<bean id="test" class="org.test.impl.TestImpl">
<property name="hazelcastInstance" ref="hazelcastClient" />
</bean>
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>file:///home/hazelcast.properties</value>
</list>
</property>
</bean>
<hz:client id="hazelcastClient">
<hz:group name="${hazelcast.server.user}" password="${hazelcast.server.password}"/>
<hz:network connection-attempt-limit="1000"
connection-attempt-period="3000"
connection-timeout="1000"
redo-operation="true"
smart-routing="true">
<hz:member>${hazelcast.server.url}:${hazelcast.server.port}</hz:member>
</hz:network>
</hz:client>
</beans>
最佳答案
我用这个改变了架构:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:int="http://www.springframework.org/schema/integration"
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.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-3.7.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
现在可以工作了,但我仍然不知道为什么。有人可以解释一下吗?
关于java - Hazelcast spring 模式配置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54865958/