0

在运行弹簧时,我收到错误消息

Unexpected exception parsing XML document from class path resource 
[spring/tx-annotation-app-context.xml]; nested exception 
is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class 
[org.springframework.data.jpa.repository.config.JpaRepositoryNameSpaceHandler] 
for namespace [http://www.springframework.org/schema/data/jpa]: problem with 
handler class file or dependent class; nested exception is 
java.lang.NoClassDefFoundError: 
org/springframework/data/repository/config/RepositoryConfigurationExtension

这是我的文件

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" 
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc 
                    http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
                    http://www.springframework.org/schema/beans 
                    http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                    http://www.springframework.org/schema/tx 
                    http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
                    http://www.springframework.org/schema/data/jpa 
                    http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd
                    http://www.springframework.org/schema/context 
                    http://www.springframework.org/schema/context/spring-context-3.1.xsd">

<description>Example configuration to get you started.</description>
    ....
</beans>

这是我包含的罐子的屏幕截图

弹簧罐

我在命名空间做错了什么?

谢谢

4

1 回答 1

1

我认为问题在于您使用的是spring-data-commons-core1.1spring-data-jpa版和 1.2 版。对齐这些库的版本。

从我看到的一个项目中查看 pom.xml 文件。

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.2.0.RELEASE</version>
</dependency>

它使用 spring-data-commons-core-1.4.0.RELEASE.jar

如果将 的打包切换spring-data-jpa为 pom,它应该下载必要的依赖项,然后将其切换回jar.

于 2013-05-03T08:03:46.583 回答