gpt4 book ai didi

spring - 运行 tomcat 时出错您不能使用 spring-security-2.0.xsd 架构

转载 作者:行者123 更新时间:2023-11-28 23:19:32 24 4
gpt4 key购买 nike

我一直收到错误:

Offending resource: ServletContext resource [/WEB-INF/project-security.xml]; 
nested exception is
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: You cannot use a spring-security-2.0.xsd or spring-
security-3.0.xsd or spring-security-3.1.xsd schema with Spring Security 3.2.
Please update your schema declarations to the 3.2 schema.

我有一台旧的部署服务器和一台新的 CentOS。基本上我所做的是安装相同的 Java 并将包含 war 文件的 tomcat 文件夹复制到新服务器。但是当我在新服务器上运行它时,出现了这个错误。

项目安全.xml

<beans xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd"
xmlns="http://www.springframework.org/schema/beans"
xmlns:cloud="http://schema.cloudfoundry.org/spring"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

项目-springapp.xml

    <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<import resource="classpath:springapp.xml"/>
<import resource="project-config.xml"/>
<import resource="project-services.xml"/>
<import resource="project-managers.xml"/>
<import resource="project-security.xml"/>
<import resource="project-spring.xml"/>
<import resource="project-partner-beans.xml"/>

最佳答案

按照错误消息所说的操作并将对 3.1 版本架构的引用替换为 3.2,这似乎是您用于 spring-security 的版本。但是您也应该检查其他架构版本。

项目安全.xml

<beans xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.2.xsd"
xmlns="http://www.springframework.org/schema/beans"
xmlns:cloud="http://schema.cloudfoundry.org/spring"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

项目-springapp.xml

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

关于spring - 运行 tomcat 时出错您不能使用 spring-security-2.0.xsd 架构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45505150/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com