Pawan Tiwari
Pawan Tiwari

Reputation: 537

How to register eureka client from Grails on eureka server in Spring boot

I want to register my eureka client that is in Grails 2.4.4 on a eureka server which is in spring boot.

I already have registered another eureka service from spring boot on the same eureka server and it is working fine. When I run grails app, it gives me an error :

| 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

Here is my application.properties file:

#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/

Any help will be appriciable.

Thanks !

Upvotes: 2

Views: 807

Answers (2)

Pawan Tiwari
Pawan Tiwari

Reputation: 537

Here are my findings that I have applied to this issue. However, I did lots of search on google to get it right back on the track.

Step 1: Create a file named eureka-client.properties

Step 2: Now remove your configuration code from application.properties file and paste it into the newly created file.

Step 3: Pass your eureka port there and of course serviceId in this file.

Configuration CODE:

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/

Now save the changes and run your application. It will connect to your Eureka server. After refreshing your Eureka home page, you will find it there.

Upvotes: 1

juanlumn
juanlumn

Reputation: 7095

Not sure if it's a TYPO in your question or a genuine error but the line eureka.port = 1116eureka.name=Grails-Service should be:

eureka.port = 1116
eureka.name=Grails-Service

Upvotes: 0

Related Questions