3

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"> <!-- 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)

4
  • I am not able to format the code correctly..Some one please correct it. Edited for 5 times but could not correct it Commented Sep 22, 2010 at 13:55
  • 1
    It's probably because Eclipses' XML Catalog is not configured to validate against the 3.0.4 schema embedded within the JAR or you are using a version of Spring Tool Suite whose XML Catalog is using the Spring jar contained in plugins, v3.0.3 as of STS 2.3.3.M3. Are you using vanilla Eclipse or Spring Tool Suite? Let me know the version and I'll take a look. Commented Sep 22, 2010 at 20:08
  • I am using eclipse and spring version 3.0.4 Commented Sep 23, 2010 at 6:44
  • I ignored this error and built the project in the tomcat webapps folder and the error i got META-INF/MAINFEST.MF missing.. any suggestion Commented Sep 23, 2010 at 17:08

4 Answers 4

4

The tag is a new feature in Spring Framework 3.0.4, so check your spring version.

Cheers

Sign up to request clarification or add additional context in comments.

Comments

1

I got the same problem with the tag . The problem is your spring version as @Drolyk sad are available in version 3.0.4 or later, so i will give you my dependencies and I am sure that if you use them u will solve this problem:

 <!-- BEGINING OF FULL SPRING 3 DEPENDENCES --> <!-- Shared version number properties --> <properties> <org.springframework.version>3.0.5.RELEASE</org.springframework.version> </properties> <!--Core utilities used by other modules. Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)--> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Expression Language (depends on spring-core) Define this if you use Spring Expression APIs (org.springframework.expression.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Bean Factory and JavaBeans utilities (depends on spring-core) Define this if you use Spring Bean APIs (org.springframework.beans.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans) Define this if you use Spring AOP APIs (org.springframework.aop.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans) This is the central artifact for Spring's Dependency Injection Container and is generally always Defined--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration Define this if you need any of these integrations--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context) Define this if you use Spring Transactions or DAO Exception Hierarchy(org.springframework.transaction.*/org.springframework.dao.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${org.springframework.version}</version> </dependency> <!--JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx) Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.(depends on spring-core, spring-beans, spring-context, spring-tx) Define this if you need ORM (org.springframework.orm.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.(depends on spring-core, spring-beans, spring-context) Define this if you need OXM (org.springframework.oxm.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Web application development utilities applicable to both Servlet and Portlet Environments(depends on spring-core, spring-beans, spring-context) Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web) Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Spring MVC for Portlet Environments (depends on spring-core, spring-beans, spring-context, spring-web) Define this if you use Spring MVC with a Portlet Container (org.springframework.web.portlet.*)--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc-portlet</artifactId> <version>${org.springframework.version}</version> </dependency> <!--Support for testing Spring applications with tools such as JUnit and TestNGThis artifact is generally always Defined with a 'test' scope for the integration testing framework and unit testing stubs--> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${org.springframework.version}</version> <scope>test</scope> </dependency> <!-- Begining of Java Standard Tag Libraries --> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.1</version> <scope>runtime</scope> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <scope>runtime</scope> <version>1.1.1</version> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>c</artifactId> <version>1.1.1</version> <scope>runtime</scope> <type>tld</type> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>fmt</artifactId> <version>1.1.1</version> <scope>runtime</scope> <type>tld</type> </dependency> <!-- End of Java Standard Tag Libraries --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <!-- END OF FULL SPRING 3 DEPENDENCES --> 

Comments

0

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.

1 Comment

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

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 />.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.