gpt4 book ai didi

java - Spring Tomcat : Non-whitespace characters are not allowed in schema elements . 锯 '301 Moved Permanently'

转载 作者:行者123 更新时间:2023-11-28 22:08:00 25 4
gpt4 key购买 nike

我正在尝试启动一个 tomcat 服务器,但在加载 spring bean 定义时遇到了问题。 applicationContext.xml 内容如下:

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task" xmlns:hz="http://www.hazelcast.com/schema/spring"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xmlns:solr="http://www.springframework.org/schema/data/solr" xmlns:elasticsearch="http://www.springframework.org/schema/data/elasticsearch"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.5.xsd
http://www.hazelcast.com/schema/spring META-INF/hazelcast-spring-2.0.xsd

http://www.springframework.org/schema/data/solr http://www.springframework.org/schema/data/solr/spring-solr.xsd


http://www.springframework.org/schema/data/elasticsearch http://www.springframework.org/schema/data/elasticsearch/spring-elasticsearch.xsd">
..
..
..
..

IDE (Idea) 表示无法解析文件 hazelcast-spring-2.0.xsd

错误日志说:

13:19:59,909 INFO  [localhost-startStop-1][XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [applicationContext.xml]
13:20:02,964 ERROR [localhost-startStop-1][ContextLoader] - Context initialization failed
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 2 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; systemId: http://hazelcast.com/schema/spring/hazelcast-spring-2.0.xsd; lineNumber: 2; columnNumber: 35; s4s-elt-character:
**Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '301 Moved Permanently'.**

我在这里做错了什么?我没有碰这个文件。

最佳答案

我解决了。问题是 applicationContext.xml“http://www.hazelcast.com/schema/spring META-INF/hazelcast-spring-2.0.xsd”中提到的 hazelcast 模式版本与我使用的实际 jar 不同,我认为我的是 2.4,所以将其更改为“http://www.hazelcast.com/schema/spring META-INF/hazelcast-spring-2.4.xsd” 解决了这个问题。解释是spring先在jar中搜索xsds,然后在internet上搜索。因此,由于版本错误,它没有在 jar 中找到它,而是访问了互联网。

关于java - Spring Tomcat : Non-whitespace characters are not allowed in schema elements . 锯 '301 Moved Permanently',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31806034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com