java - 无法读取架构文档 'http://www.springframework.org/schema/tool/spring-tool-4.1.xsd'

标签 java xml spring xsd

加载我的应用程序 spring 上下文时,出现以下错误(仅在 Linux 计算机上,在 Windows 上似乎可以正常工作):

Failed to read schema document 'http://www.springframework.org/schema/tool/spring-tool-4.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.

堆栈跟踪如下:

org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [META-INF/spring/score/context/scoreRepositoryContext.xml]
2015-03-30 11:07:49:336 127901 [main] WARN org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Ignored XML validation warning
org.xml.sax.SAXParseException; systemId: http://www.springframework.org/schema/tx/spring-tx.xsd; lineNumber: 12; columnNumber: 150; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tool/spring-tool-4.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.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:433)
at 
...
at org.springframework.shell.Bootstrap.main(Bootstrap.java:58)
Caused by: java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)

知道为什么吗?

最佳答案

问题几乎可以肯定是 Spring 库版本问题。

Update your Spring libraries on the Linux machine :

Make sure that there aren't any conflicting jars (different spring versions) on the classpath. If you use spring 3.0 there should be no big fat spring.jar (which is spring 2.5 and before). Next if you are creating a uber jar which contains all packages als make sure you copy xsd files also.

[信用:Marten Deinum (如上所述),Tristan 和 Michael Lee 通过删除网络连接检查建议改进了这个答案。]

关于java - 无法读取架构文档 'http://www.springframework.org/schema/tool/spring-tool-4.1.xsd',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29471695/

相关文章:

java - 将验证码存储在 cookie 中是否安全?

java - 注释 Propagation.NEVER 不起作用

java - Jdbc模板 : Issue with dynamically configurable query arguments

Spring Boot Web-在 Jackson 中将 FAIL_ON_UNKNOWN_PROPERTIES 设置为 false

java - JPA persistence.xml - 从引用的库添加 DAO

java - 将 JMX MBean 访问记录到日志文件中

java - 如何在本地测试 AWS SNS?

xml - 无发布管道中的 Azure XML 转换

javascript - JMeter 将 XML Stream 的输出修改为文件

xml - 如何将形状资源(xml)导入代码?