我一直收到错误:
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文件夹复制到新的服务器。但是当我在新服务器上运行它时,它会给我这个错误。
项目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.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"/>
答案 0 :(得分:0)
只需执行错误消息并将3.1版本模式的引用替换为3.2,这似乎是您用于spring-security的版本。 但是你也应该检查其他模式版本。
项目security.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">
项目springapp.xml
{{1}}