我有一个使用 spring-config-messaging-rollup.xml
配置的应用程序。部署到weblogic时,日志文件中有以下顺序的错误:
Stack trace associated with message Error in starting the MDB MyMessageConsumerEJB follows:
java.lang.reflect.InvocationTargetException
...
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 77 in XML document from class path resource [spring-config-messaging-rollup.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 77; columnNumber: 104; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'oxm:jaxb2-marshaller'.
...
10:26:00,050 WARN XmlBeanDefinitionReader - Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 77; columnNumber: 104; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/oxm/spring-oxm.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>.
...
Caused by: java.net.ConnectException: Tried all: '2' addresses, but could not connect over HTTP to server: 'www.springframework.org', port: '80'
tl;dr 服务器无法访问互联网,但正在尝试下载 spring-oxm.xsd
。
有没有办法让服务器使用此文件的本地引用?
最佳答案
我设法解决了这个问题。原来我对 http://www.springframework.org/schema/oxm/spring-oxm.xsd 的引用未在内部解析,因为依赖的 spring-oxm jar 中的 spring.schemas 文件指向 xsd 的特定版本。这导致解析器尝试在 Internet 上查找该文件。
更改我的 spring 配置文件以根据 spring.schemas
引用精确版本解决了该问题。
添加我正在维护的代码库使用过时版本的 spring 可能会有所帮助 - 较新的实现可能不会出现同样的问题。
关于java - 防止 WebLogic 服务器上的 XSD 的外部引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58283526/