java - 防止 WebLogic 服务器上的 XSD 的外部引用

标签 java spring weblogic message-driven-bean

我有一个使用 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/

相关文章:

java - mybatis 3 selectkey inside foreach

weblogic - 远程 weblogic 服务器身份异常

java - 个性化的 ApplicationContextInitializer 可能会导致错误无法打开 ServletContext 资源 [/WEB-INF/applicationContext.xml]?

java - 在 Spring Boot 中 - 应用程序数据库未创建

java - 仅保存图像的一部分而不是整个图像,我应该修复什么?

java - 如何在单个 Controller 中制作多个@PatchMapping?

java - 使用 Java 流仅通过 lambda 对任何元素执行操作

java - 当@ActiveProfiles ("test"时,如何忽略特定方法的 spring @Transactional 注释)

java - 如何解决Hibernate中的级联删除问题?

java - java中用空数据填充的oracle数组