2017-08-04 23 views
0

我不斷收到一個錯誤:錯誤在運行Tomcat不能使用彈簧安全2.0.XSD模式

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

只是做了什麼錯誤消息說,並更換到3.2,這似乎3.1版本模式的引用是版本你用於彈簧安全。 但是你也應該檢查其他模式版本。

項目的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">