i am using spring-boot-starter-parent version 2.0.0.M2 version but when i try run application i got below error..
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:120)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:84)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:62)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:72)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:360)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:328)
What version of Spring Cloud?
hi @ryanjbaxter
In my case for Spring Cloud I use:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>2.0.0.M2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-archaius</artifactId>
</dependency>
And for Spring Boot
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.0.M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
According to https://projects.spring.io/spring-cloud/ this combination (Spring Boot 2.0.0.M3 and Spring Cloud Netflix 2.0.0.M2) should work right?
Boot M5 and Finchley. M3 are the latest versions that work today, can you try with those?
Hm. How am I supposed to use Archaius with Finchley.M3? According to http://repo.spring.io/milestone/org/springframework/cloud/spring-cloud-starter-archaius/ the last Milestone Release of spring-cloud-starter-archaius was back in August. And explicitly specifying <version>2.0.0.M2</version> gave me the same exception:
15:17:20.947 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:157)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:98)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:64)
I don't see how Archaius has anything to do with it. Besides, we renamed the starters http://repo.spring.io/milestone/org/springframework/cloud/spring-cloud-starter-netflix-archaius/
Can you tell me why you aren't using the spring-cloud-dependencies BOM?
Thanks @spencergibb. In terms of declaring the dependencies it works now. I have:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.0.M5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
md5-572aead71f028b7d51d4c460478c18ee
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-archaius</artifactId>
</dependency>
md5-76a41c039a99a87d80b8f7c626bd26bd
15:28:32.158 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:157)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:98)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:64)
I created a project from start.spring.io with those dependencies and I don't get that error. My guess is you still have mixed up dependencies. If you can provide a project that recreates the problem, feel free to reopen.
Alright. Thanks for your help. Let me double-check my dependencies.
NP! I'll be happy to look again.
I have the same issue as OP. I've noticed that the BootstrapApplicationListener for the spring-cloud-context 1.3.3.RELEASE uses an empty constructor for SpringApplicationBuilder at line 161, but the 2.0.0.RELEASE of spring boot has only the following constructor:
public SpringApplicationBuilder(Class<?>... sources)
Not related. Spring cloud 1.x (Edgware and earlier) is not compatible with boot 2
@spencergibb care to share your configuration somewhere as an example / reference ?
@eepstein http://projects.spring.io/spring-cloud/#release-trains
get the similar exception when start application
10:22:51.852 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:161)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:102)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:68)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:358)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.future.auction.AuctionServerApplication.main(AuctionServerApplication.java:18)
dependency pom
```
<groupId>com.future.auction.server</groupId>
<artifactId>auction-server</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>auction-server</name>
<description>ebay auction solution</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<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>Edgware.SR3</spring-cloud.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-netflix</artifactId>
<version>1.4.4.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.saxon/saxon-dom -->
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon-dom</artifactId>
<version>8.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>2.0.6.RELEASE</version><!--$NO-MVN-MAN-VER$ -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</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-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-core</artifactId>
</dependency>
<!-- add all iText 7 Community modules -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itext7-core</artifactId>
<version>7.1.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.aliyun.mns</groupId>
<artifactId>aliyun-sdk-mns</artifactId>
<version>1.1.8</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>aliyun</id>
<name>aliyun.com</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun</id>
<name>aliyun.com</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
````
@user20161119 1.4.x is not compatible with Spring Boot 2. Please join us in gitter or stack overflow for questions
@spencergibb how to slove this problem ????
Use compatible versions
Hi @spencergibb , thanks for your answers. But 1.4.4 is the latest version for spring cloud, does that mean we have no compatible spring cloud version for spring boot 2.0+? And we have to use spring boot 1.5?
Thanks
I fixed this issue by using spring-boot 1.5.13.RELEASE with spring cloud 1.4.4.RELEASE.
@jianyuanzh we dont recommend using version numbers for the spring cloud dependencies, you should be using the Spring Cloud BOM which manages the versions for you. Our Finchley release train is compatible with Boot 2.0.x. Our latest Finchley release is RC1 which is compatible with Boot 2.0.1. Boot 2.0.2 is not compatible with Finchley.RC1, we will have another RC later next week that will be.
fixed it by aligning all spring-boot-test* dependencies versions with spring-boot-maven-plugin (made them all having the same 2.0.2.RELEASE)
Hi @ryanjbaxter, my problem has been solved. You explained it very well. Many thanks.
@ryanjbaxter Very well explained.
This certainly is meant for StackOverflow.
@spencergibb Does spring-boot 2.2.4 version goes with Hoxton.SR1? if not which will be the ideal deal? Because I wanna use Netflix Hystrix.
Hi Guys,
I am trying to build a springboot camel application. I am required to work on the config maps using kubernetes.
I have added the following dependencies in my pom:
On building the the application if am getting the following errror : "Caused by: java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.
I have tried to add springboot cloud dependencies and tried to search for the compatibility, hence i added
which is compatible with springboot 2.1.* version (mentioned in one of the forums).
I am still facing trouble with the build of the application.
Any leads are appreciated.
Thanks.
I've changed this on my pom
this
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/>
</parent>
to this
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
</parent>
We need to check our spring boot starter parent version.
@spencergibb Does spring-boot 2.2.4 version goes with Hoxton.SR1? if not which will be the ideal deal? Because I wanna use Netflix Hystrix.
+1 I have the same problem.
Most helpful comment
@jianyuanzh we dont recommend using version numbers for the spring cloud dependencies, you should be using the Spring Cloud BOM which manages the versions for you. Our Finchley release train is compatible with Boot 2.0.x. Our latest Finchley release is RC1 which is compatible with Boot 2.0.1. Boot 2.0.2 is not compatible with Finchley.RC1, we will have another RC later next week that will be.