[启动Spring Boot 2.1.1和Java 11应用程序时出现java.lang.IncompatibleClassChangeError

问题描述 投票:3回答:1

我在jdk-11.0.6上启动spring-boot 2.1.1.RELEASE应用程序时得到了java.lang.IncompatibleClassChangeError,以便从1.5.3]迁移现有的spring-boot应用程序Java 8

除了这些设置,我还使用2.1.1.RELEASE覆盖了spring-boot-starter依赖项的版本,以防止库不兼容。除了Java 11,我还在同一项目中使用groovy 3.0.0-alpha-4

您可以在下面找到详细的堆栈跟踪:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pathMappedEndpoints' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints]: Factory method 'pathMappedEndpoints' threw exception; nested exception is java.lang.IncompatibleClassChangeError: Method org.springframework.boot.actuate.endpoint.web.PathMapper.__AW_getRootPath(Ljava/util/List;Lorg/springframework/boot/actuate/endpoint/EndpointId;)Ljava/lang/String; must be InterfaceMethodref c
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627)
    at org.springframework.beans.factory.support.ConstructorResolver.__AW_instantiateUsingFactoryMethod(ConstructorResolver.java:607)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.__AW_createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.__AW_doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.__AW_createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.__AW_getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java)
    at org.springframework.beans.factory.support.AbstractBeanFactory.__AW_doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.__AW_preInstantiateSingletons(DefaultListableBeanFactory.java:846)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java)
    at org.springframework.context.support.AbstractApplicationContext.__AW_finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.__AW_run(SpringApplication.java:316)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java)
    at com.demo.api.Application.__AW_main(Application.java:22)
    at com.demo.api.Application.main(Application.java)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.__AW_main(JarLauncher.java:51)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints]: Factory method 'pathMappedEndpoints' threw exception; nested exception is java.lang.IncompatibleClassChangeError: Method org.springframework.boot.actuate.endpoint.web.PathMapper.__AW_getRootPath(Ljava/util/List;Lorg/springframework/boot/actuate/endpoint/EndpointId;)Ljava/lang/String; must be InterfaceMethodref c
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.__AW_instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
    ... 36 common frames omitted
Caused by: java.lang.IncompatibleClassChangeError: Method org.springframework.boot.actuate.endpoint.web.PathMapper.__AW_getRootPath(Ljava/util/List;Lorg/springframework/boot/actuate/endpoint/EndpointId;)Ljava/lang/String; must be InterfaceMethodref c
    at org.springframework.boot.actuate.endpoint.web.PathMapper.getRootPath(PathMapper.java)
    at org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer.createEndpoint(ServletEndpointDiscoverer.java:71)
    at org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer.createEndpoint(ServletEndpointDiscoverer.java:42)
    at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.getFilterEndpoint(EndpointDiscoverer.java:328)
    at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.isFilterMatch(EndpointDiscoverer.java:302)
    at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.isEndpointExposed(EndpointDiscoverer.java:270)
    at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.convertToEndpoints(EndpointDiscoverer.java:189)
    at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.discoverEndpoints(EndpointDiscoverer.java:127)
    at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.getEndpoints(EndpointDiscoverer.java:119)
    at org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints.lambda$getEndpoints$1(PathMappedEndpoints.java:70)
    at java.base/java.util.LinkedHashMap$LinkedValues.forEach(LinkedHashMap.java:608)
    at org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints.getEndpoints(PathMappedEndpoints.java:69)
    at org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints.<init>(PathMappedEndpoints.java:63)
    at org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration.pathMappedEndpoints(WebEndpointAutoConfiguration.java:123)
    at org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$7e6a4261.CGLIB$pathMappedEndpoints$1(<generated>)
    at org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$7e6a4261$$FastClassBySpringCGLIB$$9430a0e5.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
    at org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$7e6a4261.pathMappedEndpoints(<generated>)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.__AW_instantiate(SimpleInstantiationStrategy.java:154)
    ... 38 common frames omitted
java spring spring-boot java-11 spring-boot-actuator
1个回答
0
投票

__AW_前缀方法建议您使用ApsectWerkzAspectJ。由于错误发生在看起来像自动生成的方法上,很可能您使用的版本与Java 11不兼容。]

您可能应该首先将Groovy 3.0.0-alpha-4升级到3.0.1,在调试代码生成问题时,使用不稳定的库不是一个好主意。

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