1

I cant get past this error. The mvc xsd is correct and validated that the resources element exists. Why does this spring config file not resolve the mvc:resources element

SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'mvc:resources'

I am using springframework v3.0.2

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

    <context:component-scan annotation-config="true" base-package="com.auto"/>

    <mvc:annotation-driven />
    <mvc:view-controller path="/" view-name="index"/>

    <mvc:resources location="/resources/" mapping="/resources/**"/>

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
Byron
  • 3,833
  • 9
  • 34
  • 39

2 Answers2

3

mvc:resources was introduced in 3.0.4 and you are using 3.0.2. See the accepted answer to this question Spring serving static content with mvc:resources, invalid xsd

Community
  • 1
  • 1
digitaljoel
  • 26,265
  • 15
  • 89
  • 115
0

Make sure that the jar containig the spring-mvc-3.0.xsd is deployed. (When I remember right, it is spring-mvc.jar)

Ralph
  • 118,862
  • 56
  • 287
  • 383