微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spring.schemas 在提取的 jar 中不起作用

如何解决Spring.schemas 在提取的 jar 中不起作用

我有一个控制台应用程序试图启动一个 spring 上下文。它位于一个 jar 中,其中提取支持类以供使用。这在 eclipse 中非常有效。当我提取 jar 并尝试在控制台中运行时,它找到了 spring xml,但没有找到 xsds。

WARNING: Ignored XML validation warning
org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 58; schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context.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>.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)

我不确定为什么在 RAD 之外找不到它,但我在政府大楼工作,偏执的安全人员长期以来一直在制定奇怪的防火墙规则,然后在我们询问时没有响应问题。

所以我想我会做 spring.schemas 路线。我在 meta-inf 中创建了该文件,确认它在提取的 jar 中,并且 spring bean 和 spring 上下文都在那个 meta-inf 目录中。 spring.schema 看起来像:

http\://www.springframework.org/schema/beans/spring-beans.xsd=spring-beans.xsd
http\://www.springframework.org/schema/context/spring-context.xsd=spring-context.xsd

然而……仍然找不到上下文。我不知道如何从这里向前推进。我如何弄清楚解决这个问题缺少什么?我是否需要手动将元信息添加到类路径或其他内容中?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。