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
posted Jan 23, 2012 23:06:31
0
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: