java.lang.NoClassDefFoundError for org/springframework/aop/framework/AbstractAdvisingBeanPostProcessor

StackOverflow https://stackoverflow.com/questions/23595958

Pergunta

Folks I am getting the following compilation error:

 May 11, 2014 1:30:41 PM org.apache.catalina.core.ApplicationContext log
 SEVERE: StandardWrapper.Throwable
 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration    problem: Failed to import bean definitions from URL location [classpath*:META-  INF/spring/context.xml]
 Offending resource: ServletContext resource [/WEB-INF/spring/appServlet/servlet-  context.xml]; nested exception is  org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing   XML document from URL [jar:file:/C:/Users/Dean/Downloads/springsource/vfabric-tc-server-  developer-2.9.5.SR1/base-instance/wtpwebapps/cointraders-api/WEB-INF/lib/data-core-1.0.0-  SNAPSHOT.jar!/META-INF/spring/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

I am running spring 3.1.1.RELEASE. I have been trying to figure out this problem and there's little help from previous searches. My stack trace here link

Foi útil?

Solução 3

The documentation for AbstractAdvisingBeanPostProcessor says that it exists since version 3.2, not Spring 3.1. Also from here where you can see all the classes in the spring-aop artifact from Spring 3.1.4, that class does not seem to exist.

I suggest you upgrade to Spring 3.2 and make sure that there are no Spring 3.1 dependencies on your classpath

Outras dicas

After seeing your stack trace I noticed it saying Caused by: java.lang.ClassNotFoundException: org.springframework.aop.framework.AbstractAdvisingBeanPostProcessor

This is the cause for No class def found exception. Add spring-aop jar to your run time class path. That jar must be missing now.

I ran into this issue as well. You need to exclude the spring-aop and spring-asm that come with spring-data and specify the spring-aop version you want. I'm using gradle, here is a snippet:

compile group: 'org.springframework', name: 'spring-aop', version:'3.2.8.RELEASE'
compile (group: 'org.springframework.data', name: 'spring-data-jpa', version:'1.3.4.RELEASE'){
    exclude(module: 'spring-aop')
    exclude(module: 'spring-tx')
    exclude(module: 'spring-asm')
}

If you use maven,you can use command 'mvn dependency tree' to check you project all jar dependencies,find depend on spring3.1.x and exclusion that.

Following on from the extremely useful answer by Jay Paulynice above, my build.gradle file contains this (Spring versions are managed by our own BOM elsewhere) :-

dependencies {
  // Handle spring-aop conflict affecting AopInfrastructureBean (used by spring-security-core PermissionEvaluator).
  // Only use spring-aop from spring-security-core, and exclude any other instances of it.
  def withoutSpringAop = {
    exclude group: 'org.springframework', module: 'spring-aop'
  }
  implementation group: 'org.springframework.security', name: 'spring-security-core'
  implementation group: 'org.flywaydb', name: 'flyway-core', version: '5.1.4', withoutSpringAop
  implementation group: 'org.springframework.security', name: 'spring-security-web', withoutSpringAop
  implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', withoutSpringAop
  ...
}

This simple answer belies a lot of pain; I found it useful/necessary to search for 'aop' in the (fully expanded) dependency tree in my Intellij gradle window.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top