Eureka Server在Spring Boot中启动时出现错误 [英] Eureka Server while starting in spring boot getting the errors
问题描述
启动Eureka服务器时无法开始获取错误
While starting the Eureka Server Unable to start getting the errors
尝试通过更改云发行版来更改版本
Tried with changing the cloud release changing the versions
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>eurekaserver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>eurekaserver</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.RELEASE</spring-cloud.version>
</properties>
依赖项部分
The dependencies section
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</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-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
构建部分
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/mileston</url>
</repository>
</repositories>
</project>
日志:
2019-11-01 00:05:18.833 INFO 7544 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$3b9dbe3e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.0.RELEASE)
2019-11-01 00:05:19.455 INFO 7544 --- [ main] c.e.e.EurekaserverApplication : No active profile set, falling back to default profiles: default
2019-11-01 00:05:20.771 WARN 7544 --- [main] o.s.boot.actuate.endpoint.EndpointId:端点ID服务注册表"包含无效字符,请迁移为有效格式. 2019-11-01 00:05:21.119信息7544 --- [main] o.s.cloud.context.scope.GenericScope:BeanFactory id = 9f8a0e73-0f18-37e3-a449-5d163b119105 2019-11-01 00:05:21.158错误7544 --- [main] o.s.boot.SpringApplication:应用程序运行失败 java.lang.NoClassDefFoundError:org/apache/commons/lang/text/StrLookup 在java.base/java.lang.Class.getDeclaredConstructors0(本机方法)〜[na:na] 在java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)〜[na:na] 在java.base/java.lang.Class.getDeclaredConstructors(Class.java:2357)〜[na:na] 在org.springframework.boot.context.properties.ConfigurationPropertiesBean $ BindMethod.findBindConstructor(ConfigurationPropertiesBean.java:318)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.context.properties.ConfigurationPropertiesBean $ BindMethod.forClass(ConfigurationPropertiesBean.java:300)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator.validate(ConfigurationPropertiesBeanDefinitionValidator.java:57)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator.postProcessBeanFactory(ConfigurationPropertiesBeanDefinitionValidator.java:45)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286)〜[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] 在org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:174)〜[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)〜[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)〜[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] 在org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:315)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)〜[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] 在com.example.eurekaserver.EurekaserverApplication.main(EurekaserverApplication.java:12)〜[classes/:na] 引起原因:java.lang.ClassNotFoundException:org.apache.commons.lang.text.StrLookup 在java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)〜[na:na] 在java.base/jdk.internal.loader.ClassLoaders $ AppClassLoader.loadClass(ClassLoaders.java:178)〜[na:na] 在java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)〜[na:na] ...省略了18个常见框架
2019-11-01 00:05:20.771 WARN 7544 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format. 2019-11-01 00:05:21.119 INFO 7544 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=9f8a0e73-0f18-37e3-a449-5d163b119105 2019-11-01 00:05:21.158 ERROR 7544 --- [ main] o.s.boot.SpringApplication : Application run failed java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrLookup at java.base/java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:na] at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137) ~[na:na] at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2357) ~[na:na] at org.springframework.boot.context.properties.ConfigurationPropertiesBean$BindMethod.findBindConstructor(ConfigurationPropertiesBean.java:318) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.context.properties.ConfigurationPropertiesBean$BindMethod.forClass(ConfigurationPropertiesBean.java:300) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator.validate(ConfigurationPropertiesBeanDefinitionValidator.java:57) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator.postProcessBeanFactory(ConfigurationPropertiesBeanDefinitionValidator.java:45) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:174) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) ~[spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE] at com.example.eurekaserver.EurekaserverApplication.main(EurekaserverApplication.java:12) ~[classes/:na] Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.text.StrLookup at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na] ... 18 common frames omitted
推荐答案
此代码可能会对您有所帮助,我将代码用于pom文件,您也可以像这样查找和修复代码.
this code may be help you, i used code into my pom file, you can look and fix your code also like this.
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.sencerseven.microservices</groupId>
<artifactId>netflix-eureka-naming-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>netflix-eureka-naming-server</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</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-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<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>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
并且您必须将@EnableEurekaServer注释放入主类
And you must put @EnableEurekaServer annotation onto mainclass
这篇关于Eureka Server在Spring Boot中启动时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!