我使用的是Hazelcast 2.5。最近我们在生产服务器上发现了“APPARENT DEADLOCK”问题。在某处我们发现升级到Hazelcast 3.0或更高版本可以解决问题。现在,当我尝试升级到3.1时,我在ApplicationContext.xml中遇到以下错误,并且它不再识别命名空间“hz”。
applicationContext-hazelcast.xml内容在升级到3.1之前(删除了一些名称空间)
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-2.5.xsd">
升级到3.1(删除一些名称空间)后的applicationContext-hazelcast.xml内容
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd
http://www.hazelcast.com/schema/spring http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.xsd">
错误讯息:
Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.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>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'hz:hazelcast'.
我该怎么做?
答案 0 :(得分:1)
你似乎在下载3.1 XSD时遇到问题。当我尝试使用hazelcast-spring-3.1时,我收到了HTTP 403。
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://www.hazelcast.com/schema/spring/hazelcast-spring-3.1.xsd
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:637)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:582)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:685)
at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2175)
... 31 more
当我升级到使用hazelcast-spring-3.2时,一切都适合我,我可以通过Spring Bean获得Hazelcast实例。您是否可以尝试升级到3.2并告诉我这是否适合您。与此同时,我将在github.com/hazelcast中针对3.1问题提出问题。