Spring v3 no declaration can be found for element 'mvc:resources' Spring v3 no declaration can be found for element 'mvc:resources' xml xml

Spring v3 no declaration can be found for element 'mvc:resources'


In your spring context xml mvc namespace url should match url in schemaLocation. Something like this:

<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"       xmlns:mvc="http://www.springframework.org/schema/mvc"       xsi:schemaLocation="         http://www.springframework.org/schema/mvc         http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

This is a standard XML namespace declaration. The namespace url is sort of an unique id, which is then mapped to the actual schema location in xsi:schemaLocation.


When using Spring namespaces urls I normally do not use version information and thatworks most of the time pretty well.You might like to try the namespace url

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

instead of

http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd


I was getting the same error. The cause was the missing Maven dependency spring -webmvc. I included the below dependency and it started working.

        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc</artifactId>            <version>${spring.version}</version>        </dependency>