Java – spring data: JPA schema jparepositoryconfigdefinitionparser initialization failed

I'm trying to set up a project about spring data, but I encountered a strange error like this:

Handle problems with program files or dependency classes; The nested exception is Java Lang.noclassdeffounderror: unable to initialize class org springframework. data. jpa. repository. config. JpaRepositoryConfigDeFinitionParser

I have guided the correct schema namespace in the spring data JPA documentation site

xmlns:jpa="http://www.springframework.org/schema/data/jpa"
 xsi:schemaLocation="http://www.springframework.org/schema/data/jpa 
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"

jpa:repositories base-package="com.company.originations.dal.entities.dao"

I can't figure out what I can do here

This is the complete stack trace:

Caused by: org.springframework.beans.factory.parsing.BeanDeFinitionParsingException: Configuration problem: Failed to import bean deFinitions from URL location [classpath:/Meta-INF/spring/app-context.xml]
Offending resource: class path resource [com/company/originations/apm/configservice/cra/test/OrderPersistenceTests-context.xml]; nested exception is org.springframework.beans.factory.BeanDeFinitionStoreException: Unexpected exception parsing XML document from class path resource [Meta-INF/spring/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/aop/framework/AbstractAdvisingBeanPostProcessor
    at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
    at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.importBeanDeFinitionResource(DefaultBeanDeFinitionDocumentReader.java:192)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.parseDefaultElement(DefaultBeanDeFinitionDocumentReader.java:147)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.parseBeanDeFinitions(DefaultBeanDeFinitionDocumentReader.java:132)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.registerBeanDeFinitions(DefaultBeanDeFinitionDocumentReader.java:93)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.registerBeanDeFinitions(XmlBeanDeFinitionReader.java:493)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.doLoadBeanDeFinitions(XmlBeanDeFinitionReader.java:390)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.loadBeanDeFinitions(XmlBeanDeFinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.loadBeanDeFinitions(XmlBeanDeFinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:178)
    at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:149)
    at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:212)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:81)
    at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
    at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
    at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
    ... 28 more
Caused by: org.springframework.beans.factory.BeanDeFinitionStoreException: Unexpected exception parsing XML document from class path resource [Meta-INF/spring/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/aop/framework/AbstractAdvisingBeanPostProcessor
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.doLoadBeanDeFinitions(XmlBeanDeFinitionReader.java:412)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.loadBeanDeFinitions(XmlBeanDeFinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.loadBeanDeFinitions(XmlBeanDeFinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:143)
    at org.springframework.beans.factory.support.AbstractBeanDeFinitionReader.loadBeanDeFinitions(AbstractBeanDeFinitionReader.java:178)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.importBeanDeFinitionResource(DefaultBeanDeFinitionDocumentReader.java:186)
    ... 43 more
Caused by: 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/aop/framework/AbstractAdvisingBeanPostProcessor
    at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:139)
    at org.springframework.beans.factory.xml.BeanDeFinitionParserDelegate.parseCustomElement(BeanDeFinitionParserDelegate.java:1333)
    at org.springframework.beans.factory.xml.BeanDeFinitionParserDelegate.parseCustomElement(BeanDeFinitionParserDelegate.java:1328)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.parseBeanDeFinitions(DefaultBeanDeFinitionDocumentReader.java:135)
    at org.springframework.beans.factory.xml.DefaultBeanDeFinitionDocumentReader.registerBeanDeFinitions(DefaultBeanDeFinitionDocumentReader.java:93)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.registerBeanDeFinitions(XmlBeanDeFinitionReader.java:493)
    at org.springframework.beans.factory.xml.XmlBeanDeFinitionReader.doLoadBeanDeFinitions(XmlBeanDeFinitionReader.java:390)
    ... 48 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.urlclassloader.defineClass(urlclassloader.java:283)
    at java.net.urlclassloader.access$000(urlclassloader.java:58)
    at java.net.urlclassloader$1.run(urlclassloader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.urlclassloader.findClass(urlclassloader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at org.springframework.data.jpa.repository.config.JpaRepositoryConfigDeFinitionParser.(JpaRepositoryConfigDeFinitionParser.java:45)
    at org.springframework.data.jpa.repository.config.JpaRepositoryNameSpaceHandler.init(JpaRepositoryNameSpaceHandler.java:34)
    at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:130)
    ... 54 more
Caused by: java.lang.ClassNotFoundException: org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor
    at java.net.urlclassloader$1.run(urlclassloader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.urlclassloader.findClass(urlclassloader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 69 more

Solution

It looks like you are missing a spring data JPA dependency If you are using maven, you can add the following to your POM XML < dependencies > label:

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

If you don't use maven, you can download jars here: http://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa/1.1.2.RELEASE

And add it to the project using any dependency management methods you use

Also ensure that spring AOP dependencies are included:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>3.1.2.RELEASE</version>
</dependency>

Or download the jar here – http://mvnrepository.com/artifact/org.springframework/spring-aop/3.1.2.RELEASE

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>