当前位置: 首页 > 知识库问答 >
问题:

如何在Spring启动时在eureka服务器上从Grails注册eureka客户端

郜驰
2023-03-14

我想在Spring启动的eureka服务器上注册Grails 2.4.4中的eureka客户端。

我已经在同一台eureka服务器上从spring boot注册了另一个eureka服务,它运行良好。当我运行grails应用程序时,它会给我一个错误:

| Error 2018-02-21 17:29:39,765 [localhost-startStop-1] ERROR aws.ConfigClusterResolver  - Cannot resolve to any endpoints from provided configuration: {defaultZone=[]}
| Error 2018-02-21 17:29:39,771 [localhost-startStop-1] ERROR transport.EurekaHttpClients  - Initial resolution of Eureka server endpoints failed. Check ConfigClusterResolver logs for more info
| Error 2018-02-21 17:29:39,841 [localhost-startStop-1] ERROR discovery.DiscoveryClient  - DiscoveryClient_UNKNOWN/pawan - was unable to refresh its cache! status = There is no known eureka server; cluster server list is empty
Message: There is no known eureka server; cluster server list is empty
    Line | Method
->>  107 | execute                          in com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    134 | getApplications                  in com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator
|    137 | execute . . . . . . . . . . . .  in com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6
|     77 | execute                          in com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient
|    134 | getApplications . . . . . . . .  in com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator
|   1051 | getAndStoreFullRegistry          in com.netflix.discovery.DiscoveryClient
|    965 | fetchRegistry . . . . . . . . .  in     ''
|    414 | <init>                           in     ''
|    269 | <init> . . . . . . . . . . . . . in     ''
|    265 | <init>                           in     ''
|    257 | <init> . . . . . . . . . . . . . in     ''
|     31 | initializeEurekaClient           in EurekaConfiguration
|     20 | doCall . . . . . . . . . . . . . in BootStrap$_closure1
|    327 | evaluateEnvironmentSpecificBlock in grails.util.Environment
|    320 | executeForEnvironment . . . . .  in     ''
|    296 | executeForCurrentEnvironment     in     ''
|    266 | run . . . . . . . . . . . . . .  in java.util.concurrent.FutureTask
|   1149 | runWorker                        in java.util.concurrent.ThreadPoolExecutor
|    624 | run . . . . . . . . . . . . . .  in java.util.concurrent.ThreadPoolExecutor$Worker
^    748 | run                              in java.lang.Thread

这是我的申请表。属性文件:

#Grails Metadata file
#Grails Metadata file

#Grails Metadata file
#Grails Metadata file
#Fri Jan 19 17:25:36 IST 2018
app.grails.version=2.4.4
app.name=GrailsMicroservice
app.version=0.1
#app.port=8080
eureka.region = default
eureka.vipAddress = localhost
eureka.port = 1116eureka.name=Grails-Service
eureka.hostname=localhost
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:1116/eureka/

任何帮助都是值得的。

谢谢

共有2个答案

逄念
2023-03-14

不确定这是你的问题中的一个输入错误还是一个真正的错误,但行eureka。端口=1116eureka。name=Grails服务应该是:

eureka.port = 1116
eureka.name=Grails-Service
蒯卓君
2023-03-14

以下是我在这个问题上的发现。然而,我在谷歌上做了很多搜索,让它回到正轨。

步骤1:创建一个名为eureka-client的文件。属性

步骤2:现在从应用程序中删除配置代码。属性文件,并将其粘贴到新创建的文件中。

第三步:在那里传递您的eureka端口,当然还有这个文件中的serviceId

配置代码:

app.grails.version=2.4.4
app.name=GrailsMicroservice
app.version=0.1
#app.port=8080
eureka.region = default
eureka.vipAddress = localhost
eureka.port = 1116
eureka.name=Grails-Service
eureka.hostname=localhost
eureka.preferSameZone=true
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://localhost:1116/eureka/

现在保存更改并运行应用程序。它将连接到您的Eureka服务器。刷新您的Eureka主页后,您将在那里找到它。

 类似资料:
  • 在Spring中,启动服务具有@EnableDiscoveryClient注释,但我们不指定运行Eureka服务器的端口。那个么,服务如何确定Eureka服务器运行在哪个端口上呢?

  • 我对docker,Spring框架的一切都很陌生…它们成功地在localhost环境中运行,现在我想把它们推送到docker中,但是总是给我错误,我在那里卡住了大约一周。有人能帮我弄清楚吗!!! 现在我有 eureka 服务器和云配置服务器服务,这是我的代码: 尤里卡服务器应用程序.yml 和 Dockerfile: 现在我有云配置服务器应用程序.yml:在这个文件中,我试图在github上备份它

  • 我正在本地主机上运行我的eureka服务器。我可以在运行服务的本地主机上注册所有其他服务器,一切正常。 现在我想注册一个运行在linux机器上的服务。我的属性看起来是这样的: 但是服务无法在localhost的eureka服务器上注册。(最后,它的服务在localhost上运行) 我得到这些例外: 但我可以从本地主机上运行的配置服务中获取配置文件。 从linux机器(客户端)到本地主机(服务器),

  • 我正在使用Spring Boot注册服务器(Eureka服务器)。目前它正在使用以下配置。 项目名称:注册服务 内部主要方式:系统。setProperty(“spring.config.name”、“注册服务”); "yml file": 文件名:注册-服务内容: 通过以上配置,应用程序开始在2323上运行。但如果我换了Spring。配置。名称,它不工作,开始给连接拒绝异常。 > 为什么会这样?即

  • pom.xml 主应用程序类 Application.Properties eureka客户端设置 pom.xml Application.Properties 我在eureka-server仪表板(http://localhost:8761)中没有看到向Eureka server注册的micro-service-currency-exchange-service 为什么eureka客户端没有注册

  • 有三种服务: 用户服务 发现服务 >服务授权>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 我已配置eureka服务器,该服务器已启动并运行,并且我已向以下用户服务注册: 应用属性(用户服务) 我可以看到注册的用户服务,这是可以的Spring Boot应用程序