我有一个使用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
。
是否有一种方法可以使服务器改为对此文件使用本地引用?
我设法解决了这个问题。原来我对http://www.springframework.org/schema/oxm/spring-oxm.xsd的引用在内部没有解决,因为从属spring-oxm jar中的spring.schemas
文件指向xsd的特定版本。这导致解析器尝试在Internet上查找文件。
根据spring.schemas
更改我的spring配置文件以引用精确版本,从而解决了该问题。
可能会有助于添加我正在维护的代码库使用过时的spring版本-较新的实现可能不会遇到相同的问题。