线程“main"中的Spring引导异常java.lang.NoSuchMethodError: org.springframew..(版本问题) [英] Spring boot-Exception in thread "main" java.lang.NoSuchMethodError: org.springframew..(Version Issue)
问题描述
我在运行服务器时遇到异常.我知道这是 Spring boot
和 spring-cloud
的版本问题.但我正在使用 spring boot 1.4.2.RELEASE
和当前 spring cloud
使用 Finchley.SR1
.
I am getting Exception while running server .I know it is version issue of Spring boot
and spring-cloud
. But I am using spring boot 1.4.2.RELEASE
and currently spring cloud
using Finchley.SR1
.
spring boot 1.4.2.RELEASE 适合什么版本的spring cloud?
What is suitable version of spring cloud with spring boot 1.4.2.RELEASE?
在下面得到异常:
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:170)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:104)
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent(BootstrapApplicationListener.java:70)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:68)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:337)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
at com.sarathi5.Sarathi5TestCase2Application.main(Sarathi5TestCase2Application.java:14)
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>TestCase2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>TestCase2</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<!-- <version>2.0.1.RELEASE</version> -->
<relativePath/><!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<drools.version>6.2.0.Final</drools.version><!--7.6.0.Final -->
<!--<spring-cloud.version></spring-cloud.version> -->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Finchley.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
请帮我看看有什么问题?
Please help me the what is an issue?
推荐答案
问题已解决.我已经将 spring boot
依赖版本从 1.4.2.RELEASE
更新为 1.5.19.RELEASE
.及其支持的 spring-cloud 依赖管理 Edgware.SR5
.
Issue solved. I've updated spring boot
dependency version from 1.4.2.RELEASE
to 1.5.19.RELEASE
. and its supporting spring-cloud dependency management Edgware.SR5
.
版本相关明确信息提供链接:
Spring Cloud Edgware 发行说明:https://github.com/spring-项目/spring-cloud/wiki/Spring-Cloud-Edgware-Release-Notes
Spring Cloud Camden 发行说明:https://github.com/spring-项目/spring-cloud/wiki/Spring-Cloud-Camden-Release-Notes
Spring Cloud Finchley 发行说明:https://github.com/spring-项目/spring-cloud/wiki/spring-cloud-finchley-release-notes
版本更新,spring boot:1.5.19-RELEASE 和 spring云:Edgware.SR5
version updated, spring boot:1.5.19-RELEASE and spring cloud:Edgware.SR5
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!-- <version>1.4.2.RELEASE</version> -->
<version>1.5.19.RELEASE</version>
<!-- <version>2.0.1.RELEASE</version> -->
<relativePath/><!-- lookup parent from repository -->
</parent>
更新依赖:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.SR5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
更新这两个依赖后只需更新maven项目(右键项目->maven->update)和mvn clean install.
After updating this two dependencies just update maven project(right click project->maven->update) and mvn clean install.
问题已解决.
这篇关于线程“main"中的Spring引导异常java.lang.NoSuchMethodError: org.springframew..(版本问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!