我有一个控制台应用程序试图启动一个弹簧上下文。它在一个 jar 中,支持类被提取出来以便在 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.schemas 看起来像:
http\://www.springframework.org/schema/beans/spring-beans.xsd=spring-beans.xsd
http\://www.springframework.org/schema/context/spring-context.xsd=spring-context.xsd
然而……上下文仍然找不到。我不确定如何从这里继续前进。我如何找出解决这个问题的方法?我是否需要手动将元信息添加到类路径或其他东西?