2013-10-07 9 views
6

Sto utilizzando Spring 3.2.3.RELEASE con Maven per tirare le dipendenze. Quando si costruisce il progetto in Eclipse sto ottenendo seguente errore:Il carattere jolly corrispondente è rigoroso, ma non è possibile trovare alcuna dichiarazione per il contesto dell'elemento: componente-scan '

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'. 

mio appication-context.xml ha la seguente:

<?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" /> 

so che sto tirando i file jar corretti come i miei spettacoli Maven Dipendenze :

Eclipse Maven Dependencies

All'interno delle META-INF/sping.schemas posso vedere che ho la dichiarazione dello schema proprio nel mio vaso:

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 

Ho anche guardato questi inutilmente:

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

Please help, è guida pazzesco .. .. :(

risposta

14

Per i principianti è necessario correggere le dipendenze. Stai mescolando i contenitori Spring 3.2.3 e 2.0.6 (sono problemi che attendono di accadere).

Accanto a ciò la vostra dichiarazione è errata http://www.springframework.org/schema/context/ deve essere http://www.springframework.org/schema/context.

+0

Ooo gosh grazie; non l'ho nemmeno visto; rimuovendo quel finale "/" ha fatto il trucco ... riuscirai a sistemare quelle dipendenze. – Ithar

+0

Stesse cose. Dobbiamo avere copia/incolla dello stesso tutorial con questo '/' alla fine –

Problemi correlati