运行 Spring 3 JUnit 时出现 SAXParseException

发布于 2024-10-15 01:50:06 字数 551 浏览 2 评论 0原文

我刚刚升级到 Spring 3,并尝试运行一些 JUnit 以确保一切正常。事实并非如此。加载上下文时我遇到了 SAXParseException...它抱怨道:

无法读取模式文档“http://www.springframework.org/schema/beans/spring-beans-2.0.xsd”,因为1)找不到该文档; 2)文档无法读取; 3) 文档的根元素不是 .

我怀疑它由于代理配置而无法访问 XSD。有没有办法让它停止如此努力地验证它并运行该死的东西? :)

不过,严肃地说,我在 Spring 2 下运行时没有遇到问题,所以我怀疑 Spring 2 没有费心尝试验证,但 Spring 3 却有。我希望有一种方法可以绕过该功能。

另一个线索...由于我无法运行 JUnit,我继续启动服务器(这是一个 Web 应用程序),一切似乎都进展顺利。所以这让我认为 Spring 可以很好地处理我的上下文文件。

编辑 使用 Spring 3.0 模式时会发生相同的错误

I just upgraded to Spring 3, and attempted to run some JUnits to make sure everything was copacetic. It wasn't. I got a SAXParseException when loading the context... it complained:

Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .

My suspicion is that it couldn't access the XSD due to proxy configuration. Is there a way to make it stop trying so hard to validate it and just run the darn thing? :)

In all seriousness, though, I didn't have a problem when I was running under Spring 2, so I suspect that Spring 2 didn't bother to try to validate, but Spring 3 does. I was hoping there was a way to bypass that functionality.

One further clue... Since I couldn't run the JUnits, I went ahead and fired up the server (this is a web app), and everything seemed to go swimmingly. So that makes me think that Spring is just fine with my context files as they are.

Edit The same error occurs when using instead the Spring 3.0 schemas

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初吻给了烟 2024-10-22 01:50:06

可能是因为您使用的是 spring 2 的 xsd。您可以尝试使用 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

It could be because you are using xsd of spring 2. You could try using http://www.springframework.org/schema/beans/spring-beans-3.0.xsd.

薄凉少年不暖心 2024-10-22 01:50:06

事实证明,我的问题是将弹簧罐重新捆绑到一个罐子中的结果。仅使用单独的罐子对我来说效果很好。

As it turns out, my problem was a result of re-bundling the spring jars into a single jar. Just using the separate jars worked fine for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文