我已按照以下说明进行操作: https://cloud.spring.io/spring-cloud-static/Dalston.SR5/multi/multi_spring-cloud-eureka-server.html
没有成功,不知道会缺少什么。
我有一些代码演示: https: //github.com/dbranco/eureka-server
我期望运行: gradlew bootRun 并能够导航到http://localhost:8761,但我得到了
白标错误页面
此应用程序没有 /error 的显式映射,因此您将其视为后备。2019 年 7 月 9 日星期二 00:13:18 BST 出现意外错误(类型=未找到,状态=404)。没有可用的消息
当启动服务器时,我收到一些连接被拒绝的消息。有人可以查明缺少什么吗?
我尝试了这里的帖子,但没有成功: I got a "Whitelabel Error Page"when using Eureka server
I'm trying to run a very basic Eureka Server but it gives the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration': Unsatisfied dependency expressed through field 'eurekaServerBootstrap'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaServerBootstrap' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.class]: Unsatisfied dependency expressed through method 'eurekaServerBootstrap' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'peerAwareInstanceRegistry' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to …Run Code Online (Sandbox Code Playgroud) spring spring-boot microservices spring-cloud netflix-eureka
我正在使用 Spring Boot 2.4.1 和 Eureka 开发一个应用程序。我成功启动了 Eureka 服务器,但使用 Eureka 客户端时出现以下错误:
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.client.apache4.ApacheHttpClient4
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) ~[na:na]
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
... 55 common frames omitted
...
Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.cloud.netflix.eureka.CloudEurekaClient.getApplications()" because the return value of "org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration.getEurekaClient()" is null
at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.maybeInitializeClient(EurekaServiceRegistry.java:54) ~[spring-cloud-netflix-eureka-client-3.0.0.jar:3.0.0]
at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry.register(EurekaServiceRegistry.java:38) ~[spring-cloud-netflix-eureka-client-3.0.0.jar:3.0.0]
at org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration.start(EurekaAutoServiceRegistration.java:83) ~[spring-cloud-netflix-eureka-client-3.0.0.jar:3.0.0]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.2.jar:5.3.2]
Run Code Online (Sandbox Code Playgroud)
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 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.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties> …Run Code Online (Sandbox Code Playgroud) 嘿,我正在开发一个项目,我试图在服务器上注册尤里卡客户端,我很容易启用服务器,但不知何故无法让客户端启用我也添加了所需的所有依赖项。我还将在此处包含我的 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 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>3.0.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.mslab</groupId>
<artifactId>movie_service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>movie_service</name>
<description>Movie Service </description>
<properties>
<java.version>17</java.version>
<spring-cloud.version>2022.0.0-RC2</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</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-client</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</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>
<version>${project.parent.version}</version>
</plugin>
</plugins>
</build>
<repositories> …Run Code Online (Sandbox Code Playgroud) 为了熟悉Spring Cloud的Eureka客户端/服务器机制,我尝试将客户端连接到Eureka服务器并每隔5分钟打开/关闭连接,以查看Eureka服务器如何处理此问题.
我有两个Eureka客户.
第一个是通过以下代码向我提供有关已注册应用程序的信息:
@Autowired
private DiscoveryClient discoveryClient;
@RequestMapping(value = "/services", produces = MediaType.APPLICATION_JSON)
public ResponseEntity<ResourceSupport> applications() {
ResourceSupport resource = new ResourceSupport();
Set<String> regions = discoveryClient.getAllKnownRegions();
for (String region : regions) {
Applications allApps = discoveryClient.getApplicationsForARegion(region);
List<Application> registeredApps = allApps.getRegisteredApplications();
Iterator<Application> it = registeredApps.iterator();
while (it.hasNext()) {
Application app = it.next();
List<InstanceInfo> instancesInfos = app.getInstances();
if (instancesInfos != null && !instancesInfos.isEmpty()) {
//only show one of the instances
InstanceInfo info = instancesInfos.get(0);
resource.add(new Link(info.getHomePageUrl(), "urls"));
}
}
}
return …Run Code Online (Sandbox Code Playgroud) spring service-discovery spring-boot spring-cloud netflix-eureka
我开始使用Netflix Eureka并使用其1.1.145(https://github.com/Netflix/eureka/tree/1.1.145)版本.
我想在不同的端口上本地启动同一应用程序的2个实例,并让它们都注册到Eureka.我正在使用示例服务(https://github.com/Netflix/eureka/blob/1.1.145/eureka-server/conf/sampleservice/sample-eureka-service.properties)
所以我使用上面的配置启动了Eureka本身和2个实例 - 一个应用程序在8001端口上,另一个在8002上.
出于某种原因,我在任何时候都只有一个在Eureka注册的实例.他们两个都没有例外地开始,可以和Eureka OK谈谈.当我启动第二个实例时,它似乎只是用自己的信息覆盖有关第一个实例的信息.
我想要的是在http:// localhost/eureka/v2/apps下的同一个逻辑eureka.name下有2个'instance'元素
我错过了什么?
当客户端应用程序注册到Spring Eureka服务器时,客户端ID出现在仪表板上,但链接URL仅包含没有客户端上下文路径的主机名和端口.
如果我在没有设置上下文路径的情况下创建Spring Boot客户端应用程序,我的意思是默认的根上下文,Eureka服务器可以访问那里可用的所有执行器.
有没有办法通知Eureka服务器?我试图设置健康和信息属性,但它不起作用.
我正在尝试为spring cloud eureka服务器启用https.Yaml配置:
server:
port: 8100
ssl:
clientAuth: want
protocol: TLS
key-store: classpath:keystore/keystore.jks
key-store-password: some
key-password: some
eureka:
instance:
prefer-ip-address: true
non-secure-port-enabled: false
secure-port-enabled: true
secure-port: ${server.port}
healthCheckUrl: https://${eureka.hostname}:${secure-port}/health
statusPageUrl: https://${eureka.hostname}:${secure-port}/info
homePageUrl: https://${eureka.hostname}:${secure-port}/
security:
basic:
enabled: true
Run Code Online (Sandbox Code Playgroud)
然后我启动一个客户端注册到服务器.我没有导入cource的自签名证书我得到了exc.security.provider.certpath.SunCertPathBuilderException :无法找到所请求目标的有效证书路径.我不想导入证书,因为有很多实例和证书管理成本很高.因此,我将cert放在classpath中并在启动时加载它.我通过添加代码覆盖客户端默认的ssl上下文和ssl套接字facotory
SSLContext.setDefault(sslContext);
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
Run Code Online (Sandbox Code Playgroud)
它使用假装调用其他eureka客户端时工作正常.但是,在注册到eureka服务器时它没有任何努力.我检查了源代码,发现eureka发现客户端使用jersey,jersey调用http apache客户端.麻烦的是,它使用SchemeRegistryFactory.createDefault(),它将最终调用不考虑系统属性的SSLContexts.createDefault().换句话说,这个http客户端不会标记我的自定义SSLContexts.所以我的问题是,有一种方法可以在eureka发现客户端中添加/重新定位/替换默认的http客户端吗?
我已经设置了Intershop Commerce Management 7.8并且一切运行正常,除了我在错误日志文件中出现常量错误.
Eureka正在运行,我可以使用http:// localhost:8760访问Eureka UI .应用程序服务器和Solr已列出并正在运行.
eureka-client.properties中的URL设置为: http:// localhost:8760/eureka
任何想法在这里有什么不对?
这里有一些错误条目:
[2017-03-07 10:39:10.865 +0000] ERROR localhost ES1 appserver0 [] [] com.netflix.discovery.DiscoveryClient [] [] [] [] "DiscoveryClient-CacheRefreshExecutor-0" DiscoveryClient_DEVELOPER-SOLRSERVER/localhost_appserver0 - was unable to refresh its cache! status = Bad status: 404 java.lang.RuntimeException: Bad status: 404
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1589)
at com.netflix.discovery.DiscoveryClient.makeRemoteCallWithFollowRedirect(DiscoveryClient.java:1460)
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1443)
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1394)
at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1136)
at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:1042)
at com.netflix.discovery.DiscoveryClient.access$2100(DiscoveryClient.java:123)
at com.netflix.discovery.DiscoveryClient$CacheRefreshThread.run(DiscoveryClient.java:1900)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[2017-03-07 10:39:14.269 +0000] ERROR localhost ES1 appserver0 …Run Code Online (Sandbox Code Playgroud) 我有一个Eureka Server在默认的localhost主机和端口8761上运行,因此我尝试通过以下方式更改此默认配置:
server:
port: 6000
servlet:
context-path: /myeureka
eureka:
client:
register-with-eureka: false
fetch-registry: false
Run Code Online (Sandbox Code Playgroud)
但是以这种方式,仅使用默认配置就无法访问eureka仪表板:
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
Run Code Online (Sandbox Code Playgroud)
在我的客户端中,同样的事情发生了,我无法指向不同于默认值的另一个eureka服务器(localhost:8761),请参阅我的配置:
server:
port: 7000
servlet:
context-path: /client-eureka
spring:
application:
name: client-eureka
eureka:
instance:
prefer-ip-address: true
client:
eureka-server-port: 6000
eureka-server-u-r-l-context: /myeureka
Run Code Online (Sandbox Code Playgroud)
在客户端日志中查找,我得到以下信息:
2018-09-01 09:19:37.175 INFO 4931 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8761/eureka/
Run Code Online (Sandbox Code Playgroud)
无论我在客户端中配置什么端口或主机,都应始终尝试达到默认值。
重要提示:我正在此版本中使用eureka:https : //mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-eureka-server/2.0.1.RELEASE
netflix-eureka ×10
spring-cloud ×7
spring-boot ×6
java ×4
spring ×4
intershop ×1
maven ×1
netflix ×1
ssl ×1