org.springframework.aop.config.internalAutoProxyCreator':BeanPostProcessor - 嵌套异常是java.lang.AbstractMethodError

问题描述 投票:0回答:2

Tomcat 在部署 Spring 应用程序时抛出以下错误

2022-10-04 09:23:34.427 INFO  [factory.annotation.AutowiredAnnotationBeanPostProcessor] - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2022-10-04 09:23:34.584 WARN  [context.support.XmlWebApplicationContext] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.AbstractMethodError
2022-10-04 09:23:34.586 ERROR [web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.config.internalAutoProxyCreator': BeanPostProcessor before instantiation of bean failed; nested exception is java.lang.AbstractMethodError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:477)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:225)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:703)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:527)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:401)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:292)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5197)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5720)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1705)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1695)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.AbstractMethodError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1041)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1015)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:471)
    ... 19 more

Gradle 依赖树看起来像

runtimeClasspath - Runtime classpath of source set 'main'.
+--- org.springframework.security:spring-security-config:5.7.3
|    +--- org.springframework.security:spring-security-core:5.7.3
|    |    +--- org.springframework.security:spring-security-crypto:5.7.3
|    |    +--- org.springframework:spring-`aop`:5.3.22 -> 5.3.23
|    |    |    +--- org.springframework:spring-beans:5.3.23
|    |    |    |    \--- org.springframework:spring-core:5.3.23
|    |    |    |         \--- org.springframework:spring-jcl:5.3.23
|    |    |    \--- org.springframework:spring-core:5.3.23 (*)
|    |    +--- org.springframework:spring-beans:5.3.22 -> 5.3.23 (*)
|    |    +--- org.springframework:spring-context:5.3.22 -> 5.3.23
|    |    |    +--- org.springframework:spring-aop:5.3.23 (*)
|    |    |    +--- org.springframework:spring-beans:5.3.23 (*)
|    |    |    +--- org.springframework:spring-core:5.3.23 (*)
|    |    |    \--- org.springframework:spring-expression:5.3.23
|    |    |         \--- org.springframework:spring-core:5.3.23 (*)
|    |    +--- org.springframework:spring-core:5.3.22 -> 5.3.23 (*)
|    |    \--- org.springframework:spring-expression:5.3.22 -> 5.3.23 (*)
|    +--- org.springframework:spring-aop:5.3.22 -> 5.3.23 (*)
|    +--- org.springframework:spring-beans:5.3.22 -> 5.3.23 (*)
|    +--- org.springframework:spring-context:5.3.22 -> 5.3.23 (*)
|    \--- org.springframework:spring-core:5.3.22 -> 5.3.23 (*)
+--- org.springframework:spring-orm:5.3.23
|    +--- org.springframework:spring-beans:5.3.23 (*)
|    +--- org.springframework:spring-core:5.3.23 (*)
|    +--- org.springframework:spring-jdbc:5.3.23
|    |    +--- org.springframework:spring-beans:5.3.23 (*)
|    |    +--- org.springframework:spring-core:5.3.23 (*)
|    |    \--- org.springframework:spring-tx:5.3.23
|    |         +--- org.springframework:spring-beans:5.3.23 (*)
|    |         \--- org.springframework:spring-core:5.3.23 (*)
|    \--- org.springframework:spring-tx:5.3.23 (*)
+--- org.springframework:spring-web:5.3.23
|    +--- org.springframework:spring-beans:5.3.23 (*)
|    \--- org.springframework:spring-core:5.3.23 (*)
+--- javax.inject:javax.inject:1
+--- com.fasterxml.jackson.core:jackson-core:2.2.0 -> 2.13.2 (*)
+--- com.fasterxml.jackson.core:jackson-databind:2.2.0 -> 2.13.2.2 (*)
+--- org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1
+--- com.javadocmd:simplelatlng:1.0.1
+--- xerces:xercesImpl:2.11.0
|    \--- xml-apis:xml-apis:1.4.01
+--- org.drools:drools-compiler:5.3.0.Final
|    +--- org.drools:drools-core:5.3.0.Final
|    |    +--- org.mvel:mvel2:2.1.0.drools4
|    |    \--- org.drools:knowledge-api:5.3.0.Final
|    +--- org.antlr:antlr-runtime:3.3
|    |    \--- org.antlr:stringtemplate:3.2.1
|    |         \--- antlr:antlr:2.7.7
|    +--- org.antlr:antlr:3.3
|    |    \--- org.antlr:antlr-runtime:3.3 (*)
|    +--- org.antlr:stringtemplate:3.2.1 (*)
|    +--- antlr:antlr:2.7.7
|    +--- org.eclipse.jdt.core.compiler:ecj:3.5.1
|    \--- org.mvel:mvel2:2.1.0.drools4
+--- com.trilead:trilead-ssh2:1.0.0-build222
+--- javax.servlet:javax.servlet-api:3.0.1
+--- org.springframework:spring-beans:5.3.23 (c)
+--- org.springframework:spring-context:5.3.23 (c)
+--- org.springframework:spring-core:5.3.23 (c)
\--- org.springframework:spring-expression:5.3.23 (c)

我有其他 jar 的传递依赖 仅编译 'org.aspectj:aspectjweaver:1.9.2' 仅编译 'org.aspectj:aspectjrt:1.8.0'

我已经删除了 aop 依赖项的所有传递性发生,但仍然面临同样的问题。 我已经查看了类方法的实现。不知怎的,它无法识别它或者可能指向其他版本。

java spring hibernate spring-mvc gradlew
2个回答
0
投票

感谢您直接指出我正确的方向。

发现我的问题,原因是我的项目中有 activemq-all 依赖项,该项目附带了较旧版本的 spring。这个 spring 依赖项没有显示在依赖项树中,因为它包含在同一个 activemq-all jar 中。


0
投票

当项目中有以下jar且项目/依赖项目有低于版本5的spring jar时,会出现此错误

  • 弹簧数据键值
  • spring-data-redis
  • spring-data-commons

解决方法:使用版本5以上的spring jar。请检查所有依赖的项目。

© www.soinside.com 2019 - 2024. All rights reserved.