kobi
kobi

Reputation: 129

context:component-scan cannot be defined

I am having a problem with the Spring-contex definitions. When I look at other people who had this problem, it was normally becasue of usign the wrong schema declerations, but I don't think this is the case with my issue.

Line 21 in XML document from ServletContext resource [/WEB-INF/spring/web-application-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 21; columnNumber: 67; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:component-scan'.

here is the xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context/spring-context-4.1.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
                http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
                http://www.springframework.org/schema/aop
                http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
                http://www.springframework.org/schema/tx
                http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
                http://www.springframework.org/schema/context
                http://www.springframework.org/schema/context/spring-context-4.1.xsd
                http://www.springframework.org/schema/mvc
                http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd">

<!-- Imports the configurations of the different infrastructure systems of the application -->

<context:component-scan base-package="com.robert.login" />
<mvc:annotation-driven />
<import resource="webmvc-context.xml" />
<bean name="LoginInfo" class="com.robert.login.LoginInfo" />

</beans>

I'm using Spring-4.1.6

Upvotes: 0

Views: 1069

Answers (1)

6ton
6ton

Reputation: 4214

I think you need to fix this:

xmlns:context="http://www.springframework.org/schema/context/spring-context-4.1.xsd"

Should be:

xmlns:context="http://www.springframework.org/schema/context"

Upvotes: 1

Related Questions