I was trying to use <context:component-scan> in my demo project and encounter an error.
I have searched the solutions on the Internet, but can't get satisfied answer.
The following two links are similar with my problems:
The first one's error message is almost same with me, however the reason is he made a copy/paste mistake in configure file. I checked my file and there is no such problem.
The second solution does solve my problem, but not perfectly. I will get correct result of my app when apply this
solution, but it's a solution for offline mode(without Internet connection). Moreover, there is still error information saying "Failed to read schema document 'http://www.springframework.org/schema/tool/spring-tool-3.0.xsd'"
My configure file is:
When I replace the "spring-context-3.0.xsd" with "spring-context-2.5.xsd", everything is OK.
<?xml version = "1.0" encoding = "UTF-8"?>
<context:component-scan base-package="com.springinaction.autodiscovery" />
Also, I can view the content of both "spring-context-3.0.xsd" and "spring-context-2.5.xsd" from the Eclipse.
I want to know the reason of the problem and the strange phenomena.
Thank you in advance~
Here is the error I got:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/context/spring-context-3.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [autodiscovery.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.
... 14 more