2013-10-07 13 views
6

Ben bağımlılıkları çekmeye maven ile 3.2.3.RELEASE Spring kullanıyorum. Eclipse projesi oluştururken aşağıdaki alıyorum hata:eşleştirme joker sıkı, ancak hiçbir beyan elemanı bulunabilir 'bağlam: bileşen tarama'

Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 17 in XML document from class path resource [META-INF/spring/application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 17; columnNumber: 64; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'. 

Benim İMKB'de İşlem Gören-context.xml aşağıdaki sahiptir:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    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.2.xsd 
    http://www.springframework.org/schema/context/ 
    http://www.springframework.org/schema/context/spring-context-3.2.xsd"> 

    <context:component-scan base-package="com.example" /> 

benim Maven bağımlılıklar gösterildiği gibi doğru kavanoz dosyaları çekiyorum biliyoruz :

benim kavanoza doğru şema beyanı bulunur görebilirsiniz META-INF/sping.schemas İç

Eclipse Maven Dependencies

:

http\://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd 
http\://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd 
http\://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd 
http\://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd 
http\://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd 

Ben de boşuna bu baktım:

Can't load spring 3 schemas

The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-driven'

No declaration can be found for element 'context:component-scan'

The matching wildcard is strict, but no declaration can be found for element 'context:component-scan

yardım edin, bu beni deli ediyor .. .. :(

cevap

14

Yeni başlayanlar için bağımlılıklarınızı düzeltmelisiniz. Spring 3.2.3 ve 2.0.6 kavanozlarını karıştırıyorsunuz.

Bunun yanında, bildiriminiz http://www.springframework.org/schema/context olmalıdır.

+0

Ooo gosh teşekkürler; bunu görmedim bile; Bu finali kaldırarak "/" hile yaptı ... bu bağımlılıkları sıralamaya başlayacak. – Ithar

+0

Aynı şey. Aynı öğreticiyi bu uçta kopyala/yapıştırmalıyız. –