Spring 3.0 - Unable to find Spring namespace namespace for XML Schema namespace context

Could not find SpringNamespaceHandler for XML Schema Namespace [ http://www.springframework.org/schema/context]

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate NamespaceHandler for namespace [http://www.springframework.org/schema/context] Offending resource: ServletContext resource [/WEB-INF/HelloWorld-service.xml] 

This is my HelloWorld-service.xml:

 <?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd" default-autowire="byName"> <context:component-scan base-package="com.test.service"> <context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/> </context:component-scan> 

In my pom.xml, I have:

 <properties> <spring.version>3.0.5.RELEASE</spring.version> </properties> ........ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> 

The structure of the tree structure of the project:
enter image description here Any ideas what could be causing this?

+7
java spring xml spring-mvc maven
source share
3 answers

Usually this happens when I launched WebApp in eclipse; I don’t know why, it seems that Eclipse cannot find spring banks containing spring XSD schemes. I usually solved this by adding spring jars to the WEB-INF / lib directory (using the same name specified in pom.xml)

+1
source share

If you are using eclipse, try the following steps:

Right-click project-> properties-> Deployment Assembly-> Java Assembly Path Entries-> Maven Dependencies

This means adding maven dependencies in your deployment assembly.

+1
source share

I had success using the spring specification ("material specification") in my POM project:

 <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-framework-bom</artifactId> <version>3.2.6.RELEASE</version> <scope>import</scope> <type>pom</type> </dependency> </dependencies> </dependencyManagement> 

But the earliest version of spring-framework-bom is in the central maven 3.2.6.RELEASE repository , and you will have to switch to another version to use the specification. The specification provides consistent resolution of artifacts by version. It also allows you to remove all <version>${spring.version}</version> from your dependencies.

And the "withoutlessless" xsd links:

 xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> 
0
source share

All Articles