spring - org.xml.sax.SAXParseException ... no declaration can be found for element 'context:component-scan' -
i have eclipse-maven-spring project , applicationcontext.xml
in it. is:
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <description>soapclient1</description> <context:component-scan base-package="hu.bz.ikti.soap.test"/> ... </beans>
when xml parsed following error:
exception in thread "main" org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 19 in xml document class path resource [meta-inf/spring/app-context1.xml] invalid; nested exception org.xml.sax.saxparseexception: cvc-complex-type.2.4.c: matching wildcard strict, no declaration can found element 'context:component-scan'. @ org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:396)
there error sign @ begining of the later folloving <http>
xml element:
cvc-complex-type.2.4.a: invalid content found starting element 'http'. 1 of '{"http:// www.springframework.org/schema/beans":import, "http://www.springframework.org/schema/beans":alias, "http://www.springframework.org/schema/beans":bean, wc[##other:"http://www.springframework.org/ schema/beans"], "http://www.springframework.org/schema/beans":beans}' expected.
in xsi:schemalocation
section tried add http://www.springframework.org/schema/context/spring-context-3.2.xsd, spring-context-3.1.xsd, spring-context.xsd
times got same error.
i have following in pom.xml
:
<dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>${spring.framework.version}</version> </dependency>
could please me?
the xsi:schemalocation
isn't list of schemas, it's list of pairs of namespace uri , corresponding schema location. need more like
xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
Comments
Post a Comment