ClassNotFoundException:AuditingHandlerBeanDefinitionParser

时间:2014-05-31 21:02:18

标签: java spring jpa spring-data spring-data-jpa

不确定我收到此错误的原因:

[INFO] Caused by: java.lang.ClassNotFoundException: org.springframework.data.auditing.config.AuditingHandlerBeanDefinitionParser
[INFO]  at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[INFO]  at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[INFO]  at java.security.AccessController.doPrivileged(Native Method)
[INFO]  at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[INFO]  at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
[INFO]  at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:215)
[INFO]  at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
[INFO]  ... 51 more

pom.xml

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

    <!-- Spring Data -->
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.6.0.RELEASE</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>1.6.0.RELEASE</version>
        <scope>compile</scope>
    </dependency>

servlet的context.xml中

<?xml version="1.0" encoding="UTF-8"?>  
    <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:task="http://www.springframework.org/schema/task"  
     xmlns:context="http://www.springframework.org/schema/context"  
     xmlns:tx="http://www.springframework.org/schema/tx"  
     xmlns:oxm="http://www.springframework.org/schema/oxm"
     xmlns:security="http://www.springframework.org/schema/security"
     xmlns:jpa="http://www.springframework.org/schema/data/jpa"
     xsi:schemaLocation="http://www.springframework.org/schema/mvc 
            http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
            http://www.springframework.org/schema/task   
            http://www.springframework.org/schema/task/spring-task-3.2.xsd
            http://www.springframework.org/schema/beans   
            http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
            http://www.springframework.org/schema/data/jpa
            http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.2.xsd
            http://www.springframework.org/schema/tx  
            http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
            http://www.springframework.org/schema/data/repository
            http://www.springframework.org/schema/data/repository/spring-repository.xsd
            http://www.springframework.org/schema/util
            http://www.springframework.org/schema/util/spring-util.xsd
            http://www.springframework.org/schema/oxm
            http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd
            http://www.springframework.org/schema/security 
            http://www.springframework.org/schema/security/spring-security-3.2.xsd">

更新

mvn dependency:tree | grep spring-data
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.6.0.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-commons:jar:1.6.0.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-rest-webmvc:jar:2.1.0.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-rest-core:jar:2.1.0.RELEASE:compile

1 个答案:

答案 0 :(得分:0)

AuditingHandlerBeanDefinitionParser位于spring-data-commons-1.6.0.RELEASEorg.springframework.data.config.AuditingHandlerBeanDefinitionParser中的另一个包中。因此,使用此类的方法与错误的包一起使用。