javaspringweblogicmessage-driven-bean

Prevent external reference for XSDs on WebLogic server


I have an app that uses a spring-config-messaging-rollup.xml config. When deploying to weblogic, there is the following sequence of errors in the log file:

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 the server has no access to the internet, but is trying to download spring-oxm.xsd.

Is there a way to make it so that the server uses a local reference for this file instead?


Solution

  • I managed to get past this issue. Turns out my reference to http://www.springframework.org/schema/oxm/spring-oxm.xsd was not resolving internally because the spring.schemas file in the dependent spring-oxm jar was pointing to a specific version of the xsd. This caused the resolver to try and look for the file on the internet.

    Changing my spring config file to reference the precise version as per spring.schemas fixed the issue.

    It may help to add that the codebase I'm maintaining uses an outdated version of spring - newer implementations may not have this same problem.