【问题标题】:Did Spring removed spring-security.xsd without any version from http://www.springframework.org/schema/security/?Spring 是否从 http://www.springframework.org/schema/security/ 中删除了没有任何版本的 spring-security.xsd?
【发布时间】:2023-02-23 01:41:52
【问题描述】:

我们开始发现我们的一个应用程序出现问题,错误跟踪如下。

“org.xml.sax.SAXParseException: schema_reference.4: 无法读取架构文档 'http://www.springframework.org/schema/security/spring-security.xsd',因为 1) 找不到文档;2 ) 无法读取文档;3) 文档的根元素不是 xsd:schema。”

由堆栈跟踪引起的为:

“引起:java.io.FileNotFoundException:http://www.springframework.org/schema/security/spring-security.xsd"

虽然在配置/代码/基础设施级别没有部署任何更改。 spring-security.xsd 在 xml 文件中声明如下,多年来一直以这种方式运行,所有突然的服务都无法启动,并出现上述错误。

http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd

在前往位置 http://www.springframework.org/schema/security 时,我们看到没有版本的 spring-security.xsd 存在,我们通过将 URL 更新为版本化版本来解决此问题。但是我们不确定为什么这个问题今天突然开始发生而没有任何应用程序更改,spring 是否从 http://www.springframework.org/schema/security 中删除了 spring-security.xsd 或我们缺少的任何其他内容?如果是,它可能会影响任何此类通过 url 访问非版本安全 xsd 的应用程序。

注意:如果我们检查其他模块,如 mvc,http://www.springframework.org/schema/mvc/,我们可以将非版本化的 xsd 也与版本一起存在http://www.springframework.org/schema/mvc/spring-mvc.xsd。可以看到安全模块已于 20thFeb2023 http://www.springframework.org/schema/security/ 更新,但正在寻找有关停止/删除非版本 spring-security xsd 的任何通知/公告。还可以看到存档的 2 月 19 日快照有这个 xsd https://web.archive.org/web/20230218090058/http://www.springframework.org/schema/security/

【问题讨论】:

  • 它不应该首先从那个位置加载它,而是从它运送的罐子加载它。所以你的设置还有其他问题。
  • 感谢您的回复,好吧,是的,理想情况下最好将它与类路径一起使用,我的问题是它已经以这种方式运行代码很多年了& spring 将这个 xsd 保存在 url 中,看起来将在 2 月 20 日删除,为什么他们会这样做吗?

标签: spring spring-security xsd-validation


【解决方案1】:

Spring Security 5.2 的早期版本存在一个问题,它的模式打包错过了 http 版本。更新您的 spring security 版本或更新您的 xml 以声明 https 版本 https://www.springframework.org/schema/security/spring-security.xsd

然后它将正确地从您的应用程序中的 jar 加载。

https://github.com/spring-projects/spring-security/pull/7623

【讨论】:

    猜你喜欢
    • 2016-10-03
    • 2022-07-04
    • 2014-12-04
    • 2011-01-10
    • 2011-11-03
    • 2018-11-01
    相关资源
    最近更新 更多