Java-buildpack: Does the JBP support Spring Boot 2.0?

Created on 1 Sep 2017  ·  6Comments  ·  Source: cloudfoundry/java-buildpack

All 6 comments

We have not tested against it yet, but given that the way it runs (java -jar) hasn’t changed, I have no reason to believe that it doesn’t.

I actually have a problem with the current M3. But it only happens when MongoDB is used. Cloud Foundry tries to reconfigure the MongoDB connection and runs into a NoSuchMethodError.

As far as I can see, this is due to breaking changes in the spring-data-mongo dependency.

Setup is a basic Spring Boot 2.0.0.M3 app with starters for:

  • actuator
  • data-mongo
  • web
  • etc.

The Project can be found here:
https://github.com/nt-ca-aqe/library-app/tree/master/library-service

Logs Excerpt:

2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] 2017-09-13 10:56:07.083 ERROR [] --- [ main] o.s.boot.SpringApplication : Application startup failed
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.SimpleMongoDbFactory.<init>(Lcom/mongodb/Mongo;Ljava/lang/String;)V
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.org.springframework.cloud.service.document.MongoDbFactoryCreator.createMongoDbFactory(MongoDbFactoryCreator.java:50)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.org.springframework.cloud.service.document.MongoDbFactoryCreator.create(MongoDbFactoryCreator.java:37)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.org.springframework.cloud.service.document.MongoDbFactoryCreator.create(MongoDbFactoryCreator.java:31)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.org.springframework.cloud.Cloud.getServiceConnector(Cloud.java:245)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.org.springframework.cloud.Cloud.getSingletonServiceConnector(Cloud.java:155)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.spring.AbstractCloudServiceBeanFactoryPostProcessor.reconfigureBean(AbstractCloudServiceBeanFactoryPostProcessor.java:119)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.spring.AbstractCloudServiceBeanFactoryPostProcessor.processBean(AbstractCloudServiceBeanFactoryPostProcessor.java:112)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.spring.AbstractCloudServiceBeanFactoryPostProcessor.processBeans(AbstractCloudServiceBeanFactoryPostProcessor.java:97)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.cloudfoundry.reconfiguration.spring.AbstractCloudServiceBeanFactoryPostProcessor.postProcessBeanFactory(AbstractCloudServiceBeanFactoryPostProcessor.java:63)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:127)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:122)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at library.service.ApplicationKt.main(Application.kt:17)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at java.lang.reflect.Method.invoke(Method.java:498)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
2017-09-13T12:56:07.084+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2017-09-13T12:56:07.085+02:00 [APP/PROC/WEB/0] [OUT] 2017-09-13 10:56:07.085 INFO [] --- [ main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2cfb4a64: startup date [Wed Sep 13 10:56:02 UTC 2017]; root of context hierarchy
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] 2017-09-13 10:56:07.087 WARN [] --- [ main] ConfigServletWebServerApplicationContext : Exception thrown from LifecycleProcessor on context close
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2cfb4a64: startup date [Wed Sep 13 10:56:02 UTC 2017]; root of context hierarchy
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:433)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1004)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:808)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at library.service.ApplicationKt.main(Application.kt:17)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at java.lang.reflect.Method.invoke(Method.java:498)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
2017-09-13T12:56:07.088+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] 2017-09-13 10:56:07.089 ERROR [] --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@2cfb4a64: startup date [Wed Sep 13 10:56:02 UTC 2017]; root of context hierarchy
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:420)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:95)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:240)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:582)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:558)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:952)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:527)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:228)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:959)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1035)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1011)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:963)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:808)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at library.service.ApplicationKt.main(Application.kt:17)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at java.lang.reflect.Method.invoke(Method.java:498)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
2017-09-13T12:56:07.089+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
2017-09-13T12:56:07.446+02:00 [APP/PROC/WEB/0] [OUT] Exit status 1

Yeah, this is an auto-reconfiguration issue. We depend on a version of Spring Cloud Connectors that might not be ready to go for the major version uprade to Spring Data. @scottfrederick are you aware of this and all that I’ll need to do is start using a new version of the Spring Cloud Connectors?

I've been updating our Java Test Applications to Boot 2.0. Based on that work, the only thing that seems to have a problem is that the auto-reconfiguration of Spring Data Mongo seems to be broken (API changes). I'll leave this issue open as an indicator of that, and then close it once we've got a fix in place.

Any estimation when this will be available? Also: are there applicable workarounds for the moment?

We’re quite close to delivering, but are still waiting for @scottfrederick to do a release of Spring Cloud Connectors. We’ve done significant work to simplify the auto-reconfiguration and upgrade it to use Spring Cloud Connectors 2.x. As part of that work, we submitted a PR to ensure that all configured types were compatible across both Boot 1.x and Boot 2.x. This has been included but is still undergoing testing. Once it is released, we’ll consume it and get a new version of the auto-reconfiguration into the wild.

There is no real need for a work around as everything except MongoDB auto-reconfiguration works as expected today. If you are trying to do auto-reconfiguration of MongoDB, there is no work around other than to explicitly configure your application to use the service (which you should be doing anyway; auto-reconfiguration isn’t a good choice for production systems).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CAFxX picture CAFxX  ·  13Comments

thorntonrp picture thorntonrp  ·  4Comments

pxie picture pxie  ·  20Comments

aknobloch picture aknobloch  ·  8Comments

samzilverberg picture samzilverberg  ·  13Comments