views:

179

answers:

2

I am trying to build the mvc-showcase example available here link.

But i am getting the below error:

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

Source code of servlet-context.xml is

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

    <!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->

    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven conversion-service="conversionService" />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources/ directory -->
    <resources mapping="/resources/**" location="/resources/" />

    <!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
    <beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>

    <!-- Imports user-defined @Controller beans that process client requests -->
    <beans:import resource="controllers.xml" />

    <!-- Only needed because we install custom converters to support the examples in the org.springframewok.samples.mvc.convert package -->
    <beans:bean id="conversionService" class="org.springframework.samples.mvc.convert.CustomConversionServiceFactoryBean" />

    <!-- Only needed because we require fileupload in the org.springframework.samples.mvc.fileupload package -->
    <beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />   
</beans:beans> 

NOTE: I am using Eclipse IDE and i am using spring 3.0.4 version(because i am using the same pom.xml given in the project link)

A: 

It's not related to your error, but what I am missing is <context:component-scan base-package="..."/> in your configuration.

And prefer to use <mvc:annotation-driven .../>. It get not mix up with <tx:annotation-driven .../> or <task:annotation-driven />.

amra
A: 

Unfortunately I cannot seem to get it going in Eclipse 3.6. I have however got it going in Spring Tool Suite v2.5.0.M3 (http://www.springsource.com/products/springsource-google-download) - if you check their XML Catalog their are literally dozens of entries which may negate the value of using vanilla Eclipse over STS. If you are in the process of learning Spring and are confused by the lack of getting started documentation you may want to try Spring Roo which I personally use to get a Spring MVC project going - it can be disabled afterwards if you prefer.

Check out the MVC Showcase video (http://s3.springsource.org/MVC/mvc-showcase-screencast.mov) which shows loading the MVC Showcase into STS. Please note that the only version that appears to fix the Eclipse errors (runtime is fine everywhere) is v2.5.0.M3 - just make sure that you checkout the showcase code into a new workspace for that STS version.

Hope this helps.

delimited
delimited, I downloaded spring tool suite and able to run the application there... It seems there is some problem with the eclipse
javanoob