Unk*_*own 7 java xml spring spring-mvc maven
无法找到XML架构命名空间的Spring NamespaceHandler [ 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]
Run Code Online (Sandbox Code Playgroud)
这是我的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>
Run Code Online (Sandbox Code Playgroud)
在我的pom.xml中,我有:
<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>
Run Code Online (Sandbox Code Playgroud)
项目树结构:
任何想法可能是什么原因?
通常当我在 eclipse 下启动 WebApp 时会发生这种情况;我不知道为什么,似乎 Eclipse 找不到包含 spring XSD 模式的 spring jar 通常我通过在 WEB-INF/lib 目录下添加 spring jar 来解决它(通过使用 pom.xml 中声明的相同名称)
| 归档时间: |
|
| 查看次数: |
1926 次 |
| 最近记录: |