我一直在尝试将我的应用程序升级到Spring Boot 2.它编译得很好但是当我尝试运行它时,我在日志中得到以下错误。我没有在我的项目中的任何地方使用SpringApplicationBuilder
,所以不确定为什么会出现错误。
Connected to the target VM, address: '127.0.0.1:37843', transport: 'socket'
12:43:07.895 [main] DEBUG org.springframework.boot.context.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath: [file:/usr/lib/jvm/java-8-oracle.... TONS OF FILE PATH LOGGING ....file:/opt/intellij/idea-IU-173.4301.25/lib/asm-all.jar]
12:43:08.188 [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: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.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:127)
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.freedompop.bdcp.appboy.Application.main(Application.java:31)
答案 0 :(得分:0)
仅当某些spring依赖项与Spring Boot 2不兼容时才会发生这种情况。 要使其运行,要么更新这些依赖项,要么在pom中更新您的父项
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/>
</parent>
答案 1 :(得分:0)
有效pom中依赖项中可能有多个类似的jar可以突出显示此问题。