防止WebLogic服务器上的XSD使用外部参考

问题描述 投票:0回答:1

我有一个使用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服务器无法访问Internet,但正在尝试下载spring-oxm.xsd

是否有一种方法可以使服务器改为对此文件使用本地引用?

java spring weblogic message-driven-bean
1个回答
0
投票

我设法解决了这个问题。原来我对http://www.springframework.org/schema/oxm/spring-oxm.xsd的引用在内部没有解决,因为从属spring-oxm jar中的spring.schemas文件指向xsd的特定版本。这导致解析器尝试在Internet上查找文件。

根据spring.schemas更改我的spring配置文件以引用精确版本,从而解决了该问题。

可能会有助于添加我正在维护的代码库使用过时的spring版本-较新的实现可能不会遇到相同的问题。

© www.soinside.com 2019 - 2024. All rights reserved.