配置问题:无法找到XML架构命名空间的Spring NamespaceHandler [http://www.springframework.org/schema/mvc].
任何人都可以告诉为什么会发生这种错误?这是我的配置.
<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">
Run Code Online (Sandbox Code Playgroud)
小智 8
@Tijo
你需要检查几件事:
您使用的Spring版本是否为3.0.你在配置中指的是spring-beans-3.0.xsd,spring-context-3.0.xsd和spring-mvc-3.0.xsd,所以你需要使用Spring 3.0.*JAR.
您可能已经在构建路径中拥有所有必需的JAR,很可能通过将外部JAR添加到构建路径中作为"引用库".您还需要将所有JAR保存在webapp的WEB_INF/lib /文件夹中(直接将它们放在该文件夹中,而不是放在WEB-INF/lib /的子文件夹中).只有这样,您的Web服务器才知道它们.这就是Bozho的意思.
这更加微妙.确保WEB-INF/lib文件夹中没有多个Spring JAR版本.
这些步骤也需要检查其他NameSpaceHandler错误,例如
Unable to locate Spring NamespaceHandler for XML schema namespace
http://www.springframework.org/schema/context
Run Code Online (Sandbox Code Playgroud)
要么
Unable to locate Spring NamespaceHandler for XML schema namespace
[http://www.springframework.org/schema/security]
Run Code Online (Sandbox Code Playgroud)
希望有所帮助!
Spring 需要一个NamespaceHandler可以处理mvc:命名空间的(运行时)类路径。这是MvcNamespaceHandler,它位于spring-webmvc-xx.jar。把它放在你的类路径上。
| 归档时间: |
|
| 查看次数: |
21512 次 |
| 最近记录: |