web-dev-qa-db-fra.com

L'application ne parvient pas à démarrer avec Spring Boot RC2

La mise à niveau de la botte à ressort RC1 à la botte à ressort RC2 annule la construction de plusieurs projets. J'ai décidé de poster ici avant de soulever un problème. Nous avons examiné les notes de version et ne voyons aucune modification à apporter, à part la configuration de l'actionneur. 

En regardant ce commit, il semble qu'une nouvelle version Milestone des flux de nuages ​​Spring soit nécessaire https://github.com/spring-cloud/spring-cloud-commons/commit/43ea0461ee16e1ee6f250ece8c82f323f2aef2ae

Utiliser ces versions

kotlinVersion=1.2.21
springBootVersion=2.0.0.RC2
springCloudVersion=Finchley.M6
springCloudStreamsVersion=Elmhurst.M4

nous obtenons cette erreur 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]: Factory method 'configurationPropertiesBeans' threw exception; nested exception is Java.lang.NoSuchFieldError: BINDER_BEAN_NAME
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.Java:587) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.Java:1250) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.Java:1099) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:545) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:502) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.Java:312) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:228) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:310) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:205) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.Java:238) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.Java:709) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:534) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:752) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:388) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:327) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.Java:136) ~[spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.Java:197) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.Java:104) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.Java:70) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.Java:172) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.Java:165) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.Java:139) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.Java:127) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.Java:74) ~[spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.Java:54) ~[spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.Java:351) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:317) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1246) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1234) [spring-boot-2.0.0.RC2.jar:2.0.0.RC2]
    at datahub.supplychain.SupplyChainSvcApplication$Companion.main(SupplyChainSvcApplication.kt:13) [classes/:na]
    at datahub.supplychain.SupplyChainSvcApplication.main(SupplyChainSvcApplication.kt) [classes/:na]
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_141]
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62) ~[na:1.8.0_141]
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43) ~[na:1.8.0_141]
    at Java.lang.reflect.Method.invoke(Method.Java:498) ~[na:1.8.0_141]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.Java:49) [spring-boot-devtools-2.0.0.RC2.jar:2.0.0.RC2]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.context.properties.ConfigurationPropertiesBeans]: Factory method 'configurationPropertiesBeans' threw exception; nested exception is Java.lang.NoSuchFieldError: BINDER_BEAN_NAME
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.Java:185) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.Java:579) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    ... 35 common frames omitted
Caused by: Java.lang.NoSuchFieldError: BINDER_BEAN_NAME
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration.configurationPropertiesBeans(ConfigurationPropertiesRebinderAutoConfiguration.Java:52) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$102b6094.CGLIB$configurationPropertiesBeans$1(<generated>) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$102b6094$$FastClassBySpringCGLIB$$3a233345.invoke(<generated>) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.Java:228) ~[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.Java:361) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$102b6094.configurationPropertiesBeans(<generated>) ~[spring-cloud-context-2.0.0.M6.jar:2.0.0.M6]
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_141]
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62) ~[na:1.8.0_141]
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43) ~[na:1.8.0_141]
    at Java.lang.reflect.Method.invoke(Method.Java:498) ~[na:1.8.0_141]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.Java:154) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    ... 36 common frames omitted
6
Keith Ganger

MODIFIER

Le 2 mars 2018, Spring Cloud Finchley M8 est publié. https://spring.io/blog/2018/03/02/spring-cloud-finchley-m8-is-available

De notes de version

Finchley.M8 est compatible avec Spring Boot 2.0.0.RELEASE

Finchley.M8 est la solution pour springboot2.0.0.rc2 et pour springboot2.0.0.RELEASE également 

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <Java.version>1.8</Java.version>
    <spring-cloud.version>Finchley.M8</spring-cloud.version>
</properties>

ANCIENNE SOLUTION

Si vous utilisez la dernière version pour Spring Cloud (Finchley.BUILD-SNAPSHOT), le problème sera résolu.

Ils vont probablement publier une nouvelle version bientôt.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <Java.version>1.8</Java.version>
    <spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
</properties>
6
Zsolt Tolvaly

Essayez d’utiliser parent avec la version 2.0.0.RC1 et le cloud Finchley.M6 et ces dépendances. J'ai créé mon fichier pom.xml d'après cet exemple et tout semble fonctionner correctement Je devais également supprimer log.level de la configuration * .yml, à cause du convertisseur de carte manquant.

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RC1</version>
    <relativePath/> 
  </parent>

  <properties>
    <!-- ... -->
    <spring-cloud.version>Finchley.M6</spring-cloud.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>
  </dependencies>
1
Jakub Pomykała

Spring Boot 2.0.0.RC2 n'est pas compatible avec Spring Cloud Finchley.M6. Vous devez utiliser Spring Boot 2.0.0.RC1 ou attendre qu'une nouvelle version de Spring Cloud soit disponible.

1
V. Henkel

Eh bien, vous voyez le problème. Les derniers jalons de la mise à niveau vers Spring Boot RC2 ne sont pas connus étant donné que la version RC2 vient littéralement d'être publiée.

Je vous encourage à suspendre la mise à niveau vers de nouvelles versions de démarrage si vous avez intégré Spring Cloud. Vous ne pouvez pas mettre à jour vers la nouvelle version de Spring Framework sans que Spring Boot ait publié sa version dépendante.

0
Darren Forsythe