无法读取架构文档“http://www.springframework.org/schema/beans/spring-beans.xsd”,因为 1)

Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans.xsd', because 1)

提问人:Rajan 提问时间:9/22/2023 最后编辑:Rajan 更新时间:9/22/2023 访问量:20

问:

我有一个在防火墙下运行的项目。它使用具有 cxf.xml 文件的 cxf-core-3.4.4 jar,并且具有用于 spring-beans 的 xsd 模式。

执行 Java 应用程序时,遇到以下异常。

2023-09-21 18:50:03,766 [main] WARN  org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 23; columnNumber: 242; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans.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>.
.
.
.
.

    Offending resource: class path resource [applicationContext/cxf-servlet.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 
Line 23 in XML document from class path resource [META-INF/cxf/cxf.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 23; columnNumber: 242; cvc-elt.1.a: Cannot find the declaration of element 'beans'.


    .
    .
    .
    .Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf.xml]
    Offending resource: class path resource [applicationContext/cxf-servlet.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 
Line 23 in XML document from class path resource [META-INF/cxf/cxf.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 23; columnNumber: 242; cvc-elt.1.a: Cannot find the declaration of element 'beans'.
    .
    .
    .
    .
    
Caused by: java.net.ConnectException: Connection timed out (Connection timed out)
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)

从上面的堆栈跟踪来看,它似乎试图连接到SpringFramework站点以获取XSD,但由于防火墙后面,因此无法做到这一点。

我已经验证了spring.schema文件具有指向/factory/xml的xsd条目。文件夹复制到 XSD 文件,并且该文件存在。

鉴于两者都是第三方 jar,如何解决这个问题。

Spring Schema XSD-验证

评论


答: 暂无答案