spring-cloud random port not registered to Eureka -
i'm trying microservices come on random ports. if specify server.port: 0 in service bootstrap.yml suggested in spring cloud app doesn't register correct port eureka following npe:
2015-04-14 16:24:34,357 info com.fisc.restmocker.application: 47 - starting application on jsr-iaas-20 pid 4820 (c:\iaas2.0\git\fii-restmocker\build\classes\main started jsr in c:\iaas2.0\git\fii-restmocker) 2015-04-14 16:24:34,482 info ation.annotationconfigapplicationcontext: 510 - refreshing org.springframework.context.annotation.annotationconfigapplicationcontext@4fb61f4a: startup date [tue apr 14 16:24:34 edt 2015]; root of context hierarchy 2015-04-14 16:24:34,748 info ion.autowiredannotationbeanpostprocessor: 153 - jsr-330 'javax.inject.inject' annotation found , supported autowiring 2015-04-14 16:24:35,217 warn ix.config.sources.urlconfigurationsource: 120 - no urls polled dynamic configuration sources. 2015-04-14 16:24:35,560 info ontext.support.defaultlifecycleprocessor: 341 - starting beans in phase 0 2015-04-14 16:24:35,560 info lientconfigservicebootstrapconfiguration: 92 - locating configserver via discovery 2015-04-14 16:24:35,592 warn lientconfigservicebootstrapconfiguration: 113 - not locate configserver via discovery java.lang.nullpointerexception: null @ com.netflix.discovery.discoveryclient$$fastclassbyspringcglib$$a84c8cb4.invoke(<generated>) ~[spring-core-4.1.5.release.jar:1.1.147] @ org.springframework.cglib.proxy.methodproxy.invoke(methodproxy.java:204) ~[spring-core-4.1.5.release.jar:4.1.5.release] @ org.springframework.aop.framework.cglibaopproxy$cglibmethodinvocation.invokejoinpoint(cglibaopproxy.java:717) ~[spring-aop-4.1.5.release.jar:4.1.5.release] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:157) ~[spring-aop-4.1.5.release.jar:4.1.5.release] @ org.springframework.aop.support.delegatingintroductioninterceptor.doproceed(delegatingintroductioninterceptor.java:133) ~[spring-aop-4.1.5.release.jar:4.1.5.release] @ org.springframework.aop.support.delegatingintroductioninterceptor.invoke(delegatingintroductioninterceptor.java:121) ~[spring-aop-4.1.5.release.jar:4.1.5.release] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179) ~[spring-aop-4.1.5.release.jar:4.1.5.release] @ org.springframework.aop.framework.cglibaopproxy$dynamicadvisedinterceptor.intercept(cglibaopproxy.java:653) ~[spring-aop-4.1.5.release.jar:4.1.5.release] @ com.netflix.discovery.discoveryclient$$enhancerbyspringcglib$$96b726d7.getnextserverfromeureka(<generated>) ~[spring-core-4.1.5.release.jar:1.1.147] @ org.springframework.cloud.netflix.config.discoveryclientconfigservicebootstrapconfiguration.refresh(discoveryclientconfigservicebootstrapconfiguration.java:93) [spring-cloud-netflix-core-1.0.0.release.jar:1.0.0.release] @ org.springframework.cloud.netflix.config.discoveryclientconfigservicebootstrapconfiguration.onapplicationevent(discoveryclientconfigservicebootstrapconfiguration.java:65) [spring-cloud-netflix-core-1.0.0.release.jar:1.0.0.release] @ org.springframework.context.event.simpleapplicationeventmulticaster.invokelistener(simpleapplicationeventmulticaster.java:151) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.context.event.simpleapplicationeventmulticaster.multicastevent(simpleapplicationeventmulticaster.java:128) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.context.support.abstractapplicationcontext.publishevent(abstractapplicationcontext.java:331) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.context.support.abstractapplicationcontext.finishrefresh(abstractapplicationcontext.java:773) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:483) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.boot.springapplication.refresh(springapplication.java:686) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:320) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.builder.springapplicationbuilder.run(springapplicationbuilder.java:139) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.cloud.bootstrap.bootstrapapplicationlistener.bootstrapservicecontext(bootstrapapplicationlistener.java:125) [spring-cloud-config-client-1.0.0.release.jar:1.0.0.release] @ org.springframework.cloud.bootstrap.bootstrapapplicationlistener.onapplicationevent(bootstrapapplicationlistener.java:75) [spring-cloud-config-client-1.0.0.release.jar:1.0.0.release] @ org.springframework.cloud.bootstrap.bootstrapapplicationlistener.onapplicationevent(bootstrapapplicationlistener.java:1) [spring-cloud-config-client-1.0.0.release.jar:1.0.0.release] @ org.springframework.context.event.simpleapplicationeventmulticaster.invokelistener(simpleapplicationeventmulticaster.java:151) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.context.event.simpleapplicationeventmulticaster.multicastevent(simpleapplicationeventmulticaster.java:128) [spring-context-4.1.5.release.jar:4.1.5.release] @ org.springframework.boot.context.event.eventpublishingrunlistener.publishevent(eventpublishingrunlistener.java:100) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.context.event.eventpublishingrunlistener.environmentprepared(eventpublishingrunlistener.java:59) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:285) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:957) [spring-boot-1.2.2.release.jar:1.2.2.release] @ org.springframework.boot.springapplication.run(springapplication.java:946) [spring-boot-1.2.2.release.jar:1.2.2.release] @ com.fisc.restmocker.application.main(application.java:18) [main/:na] 2015-04-14 16:24:35,592 info com.fisc.restmocker.application: 56 - started application in 1.641 seconds (jvm running 2.978)
here bootstrap.yml:
info: description: fii user interface mock service spring: application: name: fii-rest-mocker cloud: config: failfast: true discovery: enabled: true serviceid: config-server username: user password: password logging: level: com.netflix.discovery: 'off' org.springframework.cloud: 'debug' eureka: instance: leaserenewalintervalinseconds: 10 metadatamap: instanceid: ${spring.application.name}:${spring.application.instance_id:${random.value}} client: serviceurl: defaultzone: ${vcap.services.${prefix:}eureka.credentials.uri:http://user:password@localhost:8761}/eureka/ server: port: 0
if remove server.port bootstrap.yml , place in fii-rest-mocker.yml inside configuration server, service starts on random port, registered on 8080 in eureka.
i running 1 eureka server , 1 config server. services running on same machine.
so, how 1 service boot , register in eureka on random port?
i'm using 1.0.0.release version of spring-cloud , 1.2.2.release of spring-boot.
random ports not compatible spring.cloud.config.discovery.enabled: true
@ moment.
Comments
Post a Comment