File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Error in Context xml file - cvc-complex-type.2.4.c: Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "Error in Context xml file - cvc-complex-type.2.4.c: " Watch "Error in Context xml file - cvc-complex-type.2.4.c: " New topic
Author

Error in Context xml file - cvc-complex-type.2.4.c:

nitinram agarwal
Ranch Hand

Joined: Jan 29, 2009
Posts: 48
Hello,
I am new to Spring and am trying to get a simple tutorial using JSP page running.

I am getting the following error in one of the context file I am using (under webContent->Web-INF folder). Following is the error message

"cvc-complex-type.2.4.c: The matching wildcard is string:but no declaration can be found for the element mvc:annotation-driven"


Here is the XML file

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16624

Because you didn't fully bring in the mvc namespace. And you have aop namespace partly in there too. xml namespaces are about xml, and Spring creates a number of xml namespaces. You need two parts in the header to add a namespace.

The first part like this

xmlns:mvc="http://www.springframework.org/schema/mvc"

sets the prefix "mvc" to the key string of "http://www.springframework.org/schema/mvc"

That key is used in the xsi:schemaLocation attribute, where you need the key and the .xsd, like a key value pair.

If you look at your schemaLocation you can see each pair. You have one for beans tags
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

You have one for context, and one for aop.

To fix it, you can just change the schemaLocation parts in the string that points to aops xsd file and where ever you see the text "aop" replace it with "mvc"

So you end up having



Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
nitinram agarwal
Ranch Hand

Joined: Jan 29, 2009
Posts: 48
thanks a lot. It has resolved the compile issue. let me try to run the application.
 
 
subject: Error in Context xml file - cvc-complex-type.2.4.c:
 
Threads others viewed
Spring Integration with Drools
The matching wildcard is strict, but no declaration can be found for element 'context:annotation'
AOP Not working with Spring 3 MVC application
Spring security - Need to secure methods - getting error
Including more than one controller having used it with sequence but error
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture