java.lang.NoSuchMethodException 将 spring-boot 应用程序部署到 Cloud Foundry 时
java.lang.NoSuchMethodException when deploying spring-boot app to cloud foundry
当我尝试 运行 我本地机器上的应用程序时它工作正常
但是当我将应用程序部署到 cloud foundry 时,我在日志中看到以下内容
org.springframework.cglib.core.CodeGenerationException: java.lang.NoSuchMethodException-->org.cloudfoundry.router.ClientCertificateMapperAutoConfiguration$$EnhancerBySpringCGLIB$ac26b9c.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
在我的 mainfist.yml 中,堆栈设置为 cflinuxfs3,构建包为 java_buildpack
我正在使用 spring-boot-starter-parent 版本 2.2.2.RELEASE
在 cf cf buildpacks | grep java_buildpack
中搜索 java 构建包时,我得到以下
buildpack, position, enabled, locked, filename, stack
java_buildpack, 2, true, false, ava-buildpack-offline-cflinuxfs3-v4.26.zip, cflinuxfs3
完整堆栈跟踪
2020-01-17 20:35:37.304 ERROR 20 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.cglib.core.CodeGenerationException: java.lang.NoSuchMethodException-->org.cloudfoundry.router.ClientCertificateMapperAutoConfiguration$$EnhancerBySpringCGLIB$ac26b9c.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.<init>(Enhancer.java:510) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.wrapCachedClass(Enhancer.java:803) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.apply(AbstractClassGenerator.java:111) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.apply(AbstractClassGenerator.java:108) ~[app/:na]
at org.springframework.cglib.core.internal.LoadingCache.call(LoadingCache.java:54) ~[app/:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_232]
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[app/:na]
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:569) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:416) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:137) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:429) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:263) ~[app/:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) ~[app/:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:130) ~[app/:na]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[app/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[app/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[app/:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[app/:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[app/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[app/:na]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [app/:na]
at APP_PACKAGE.APP_NAME.main(APP_NAME.java:52) [app/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [app/:na]
Caused by: java.lang.NoSuchMethodException: org.cloudfoundry.router.ClientCertificateMapperAutoConfiguration$$EnhancerBySpringCGLIB$ac26b9c.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
at java.lang.Class.getDeclaredMethod(Class.java:2130) ~[na:1.8.0_232]
at org.springframework.cglib.proxy.Enhancer.getCallbacksSetter(Enhancer.java:909) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.access[=14=]0(Enhancer.java:93) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.<init>(Enhancer.java:499) ~[app/:na]
... 30 common frames omitted
Exit status 0
当我删除 spring dev-tools 依赖项时它已修复
当我尝试 运行 我本地机器上的应用程序时它工作正常
但是当我将应用程序部署到 cloud foundry 时,我在日志中看到以下内容
org.springframework.cglib.core.CodeGenerationException: java.lang.NoSuchMethodException-->org.cloudfoundry.router.ClientCertificateMapperAutoConfiguration$$EnhancerBySpringCGLIB$ac26b9c.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
在我的 mainfist.yml 中,堆栈设置为 cflinuxfs3,构建包为 java_buildpack
我正在使用 spring-boot-starter-parent 版本 2.2.2.RELEASE
在 cf cf buildpacks | grep java_buildpack
中搜索 java 构建包时,我得到以下
buildpack, position, enabled, locked, filename, stack
java_buildpack, 2, true, false, ava-buildpack-offline-cflinuxfs3-v4.26.zip, cflinuxfs3
完整堆栈跟踪
2020-01-17 20:35:37.304 ERROR 20 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.cglib.core.CodeGenerationException: java.lang.NoSuchMethodException-->org.cloudfoundry.router.ClientCertificateMapperAutoConfiguration$$EnhancerBySpringCGLIB$ac26b9c.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.<init>(Enhancer.java:510) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.wrapCachedClass(Enhancer.java:803) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.apply(AbstractClassGenerator.java:111) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.apply(AbstractClassGenerator.java:108) ~[app/:na]
at org.springframework.cglib.core.internal.LoadingCache.call(LoadingCache.java:54) ~[app/:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_232]
at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[app/:na]
at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[app/:na]
at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:569) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:416) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassEnhancer.createClass(ConfigurationClassEnhancer.java:137) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:429) ~[app/:na]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:263) ~[app/:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) ~[app/:na]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:130) ~[app/:na]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[app/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[app/:na]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[app/:na]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[app/:na]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[app/:na]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[app/:na]
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:140) [app/:na]
at APP_PACKAGE.APP_NAME.main(APP_NAME.java:52) [app/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_232]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [app/:na]
Caused by: java.lang.NoSuchMethodException: org.cloudfoundry.router.ClientCertificateMapperAutoConfiguration$$EnhancerBySpringCGLIB$ac26b9c.CGLIB$SET_THREAD_CALLBACKS([Lorg.springframework.cglib.proxy.Callback;)
at java.lang.Class.getDeclaredMethod(Class.java:2130) ~[na:1.8.0_232]
at org.springframework.cglib.proxy.Enhancer.getCallbacksSetter(Enhancer.java:909) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer.access[=14=]0(Enhancer.java:93) ~[app/:na]
at org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData.<init>(Enhancer.java:499) ~[app/:na]
... 30 common frames omitted
Exit status 0
当我删除 spring dev-tools 依赖项时它已修复