Search code examples
springjhipstercloud-foundryjhipster-registry

JHipster microservices cloudfoundry deployment error


I have the following exception when deploying to cloud with cloudfoundry. This is started hapening with any jhipster deployment. Same error even when deploying jhipster-registry application to cloud.

Applications run locally without error.

2017-11-11T13:40:10.75+0300 [APP/PROC/WEB/0] OUT 2017-11-11 10:40:10.748 WARN 12 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'allowLinkingEmbeddedServletContainerCustomizer' defined in class path resource [org/cloudfoundry/container/customizer/boot1/AllowLinkingAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.NoClassDefFoundError: org/apache/catalina/Context 2017-11-11T13:40:11.54+0300 [APP/PROC/WEB/0] OUT 2017-11-11 10:40:11.535 WARN 12 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources. 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'allowLinkingEmbeddedServletContainerCustomizer' defined in class path resource [org/cloudfoundry/container/customizer/boot1/AllowLinkingAutoConfiguration.class]: Post-processing of merged bean definition failed; nested exception is java.lang.NoClassDefFoundError: org/apache/catalina/Context 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at io.github.jhipster.registry.JHipsterRegistryApp.main(JHipsterRegistryApp.java:75) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.lang.reflect.Method.invoke(Method.java:498) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/Context 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT ... 21 common frames omitted 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.lang.Class.getDeclaredMethods0(Native Method) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.buildLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:206) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(InitDestroyAnnotationBeanPostProcessor.java:125) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT ... 32 common frames omitted 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT 2017-11-11 10:40:11.661 ERROR 12 --- [ main] o.s.boot.SpringApplication : Application startup failed 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at java.lang.Class.getDeclaredMethods(Class.java:1975) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.util.ReflectionUtils.doWithLocalMethods(ReflectionUtils.java:489) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:992) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT Caused by: java.lang.ClassNotFoundException: org.apache.catalina.Context 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:526) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.findLifecycleMetadata(InitDestroyAnnotationBeanPostProcessor.java:187) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(CommonAnnotationBeanPostProcessor.java:295) 2017-11-11T13:40:11.66+0300 [APP/PROC/WEB/0] OUT at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:523) 2017-11-11T13:40:12.19+0300 [APP/PROC/WEB/0] OUT Exit status 1 2017-11-11T13:40:12.22+0300 [CELL/0] OUT Exit status 0


Solution

  • It must have something todo with the following commits few days ago

    Buildpack

    Customizer

    I fixed it for now by changing the the buildpack url to include #v3.19.2 in /deploy/cloudfoundry/manifest.yml to use the version before that change, to use the old customizer

    buildpack: https://github.com/cloudfoundry/java-buildpack#v3.19.2