Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuration problem:Spring NamespaceHandler for [http://www.springframework.org/schema/mvc]

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/mvc].

can anyone tell why this error is happening? this is my configuration.

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
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.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
like image 764
TKV Avatar asked Aug 31 '11 07:08

TKV


2 Answers

@Tijo

You need to check few things:

  1. Whether the Spring version you are using is 3.0. You are referring to spring-beans-3.0.xsd, spring-context-3.0.xsd and spring-mvc-3.0.xsd in your configuration, so you need to use Spring 3.0.* JARs.

  2. You may already have all the required JARs in the build path, most likely as "Referenced libraries" by adding external JARs to your build path. You also need to keep all the JARs in the webapp's WEB_INF/lib/ folder (put them in that folder directly, and not in a sub-folder of WEB-INF/lib/). Only then your web server knows about them. This is what Bozho means.

  3. This is more subtle. Make sure you do not have multiple Spring JAR versions in your WEB-INF/lib folder.

These are the same steps one needs to check for other NameSpaceHandler errors too, like

Unable to locate Spring NamespaceHandler for XML schema namespace
http://www.springframework.org/schema/context

or

Unable to locate Spring NamespaceHandler for XML schema namespace
[http://www.springframework.org/schema/security]

Hope that helps!

like image 197
m2p Avatar answered Nov 08 '22 06:11

m2p


Spring needs a NamespaceHandler on the (runtime) classpath that can handle the mvc: namespace. This is the MvcNamespaceHandler, and it is located in the spring-webmvc-xx.jar. Put that on your classpath.

like image 3
Bozho Avatar answered Nov 08 '22 05:11

Bozho