无法找到XML架构命名空间的Spring NamespaceHandler [http://www.springframework.org/schema/c]

时间:2016-09-06 08:38:35

标签: spring

使用spring 3.0版本并添加        xmlns:c="http://www.springframework.org/schema/c" 还有错误

INFO: Loading XML bean definitions from class path resource [resources/newSpringXMLConfig.xml]
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/c]
Offending resource: class path resource [resources/newSpringXMLConfig.xml]

3 个答案:

答案 0 :(得分:0)

“p”ad“c”命名空间在XML标头中没有架构引用。 确保在配置过程中添加了足够的jar。

jar文件的Maven配置

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>${org.springframework.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${org.springframework.version}</version>
</dependency>

答案 1 :(得分:0)

添加所有必需的罐子:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.1.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>3.1.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring</artifactId>
    <version>2.5.6</version>
</dependency>

答案 2 :(得分:0)

我正在使用spring 3.0,但无法找到c模式。刚刚升级并且运行良好。

解决方案: 将Spring 3.0升级到Spring 3.1.1.RELEASE https://mvnrepository.com/artifact/org.springframework/spring-core