These are chat archives for spring-cloud/spring-cloud

9th
Mar 2017
LIN
@magixsource
Mar 09 2017 09:42
2017-03-09 09:11:09.069  WARN 1 --- [           main] o.s.c.a.ConfigurationClassPostProcessor  : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.


2017-03-09 09:11:15.156 ERROR 1 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Cannot resolve to any endpoints from provided configuration: {defaultZone=[http://:registry-server:8761/eureka/]}
i get eureka server url from spring-cloud-config
It seen like i need warp a spring configuration and annotation with @bean ?
Dave Syer
@dsyer
Mar 09 2017 09:54
I have no idea what you mean by that
http://:registry-server:8761/eureka/ doesn't look like a real URL though
Is it actually resolvable in your environment?
LIN
@magixsource
Mar 09 2017 09:55
yes,on docker
   container_name: gateway-server
   image: gateway:latest
   external_links:
            - config-server:config-server
            - registry-server:registry-server
   environment:
            - SPRING_PROFILES_ACTIVE=docker
Dave Syer
@dsyer
Mar 09 2017 09:56
I don't see anything I can help you with here. That URL is either resolvable and it works, or it isn't and it doesn't.
I don't think the ":" before the hostname is even legal in a URL is it?
LIN
@magixsource
Mar 09 2017 09:58
2017-03-09 09:11:07.695 DEBUG 1 --- [           main] o.s.web.client.RestTemplate              : Created GET request for "http://config-server:8888/gateway-server/docker"
2017-03-09 09:11:07.772 DEBUG 1 --- [           main] o.s.web.client.RestTemplate              : Setting request Accept header to [application/json, application/*+json]
2017-03-09 09:11:07.953 DEBUG 1 --- [           main] o.s.web.client.RestTemplate              : GET request for "http://config-server:8888/gateway-server/docker" resulted in 200 (null)
get config-server is ok
Dave Syer
@dsyer
Mar 09 2017 09:59
You don't have the stray ":" in the hostname of that one
LIN
@magixsource
Mar 09 2017 10:01
thanks
i try to update docker-compose file
:)
LIN
@magixsource
Mar 09 2017 10:07
Its ok now :clap:
Ziemowit
@Ziemowit
Mar 09 2017 10:09

Hi guys!

I have already fixed the case when nonSecurePort was always 8080 whereas instanceId was correct like 172.20.39.197:foo-service:8763 in EurekaClientAutoConfiguration.

The application had still some old configuration files which were loaded in @Configuration class via @ImportResources. The port was NOT defined there so no override but seems that it was enough to interfere somehow with spring-boot. When I made refactoring and changed @ImportResource by @PropertySource it works.

LIN
@magixsource
Mar 09 2017 10:44
Glad to heart that
heard..
Charles Moulliard
@cmoulliard
Mar 09 2017 11:31
Hi Guys. Can Spring Cloud Ribbon be used in combination with Hystrix. Scenario. If no servers loadbalanced by Ribbon are available then the hystrix command should be called.
Dave Syer
@dsyer
Mar 09 2017 11:33
Ribbon is already tightly integrated with Hystrix. It's pretty hard to use one without the other.
But your use case sounds like a higher level concern: you would need to wrap an HTTP client call in a @HystrixCommand.
Which isn't really anything to do with Ribbon as such
Charles Moulliard
@cmoulliard
Mar 09 2017 11:37
Haha. So this code should be adapted -> https://goo.gl/llunZF ?
Thibaud Lepretre
@kakawait
Mar 09 2017 11:38

@dsyer I read there is some issue with Logging context and Spring context (see spring-cloud/spring-cloud-commons#125, https://github.com/spring-projects/spring-boot/issues/6688) however I still have an issue when using an Spring cloud app (no problem with Spring boot) because it comes from bootstrap context that not exists on Spring boot in correlation with logstash-logback-encoder and Logback extensions - Environment properties.

Indeed if I use following logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
    <include resource="org/springframework/boot/logging/logback/base.xml" />
    <springProperty scope="context" name="stashHost" source="myapp.stash.host" defaultValue="unresolvable_host"/>
    <appender name="STASH" class="net.logstash.logback.appender.LogstashSocketAppender">
        <host>${stashHost}</host>
    </appender>

    <root level="INFO">
        <appender-ref ref="STASH"/>
    </root>
</configuration>

with existing application.properties and correctly defined myapp.stash.host I still have un issue that complain that unresolvable_host is unreachable (unresolvable_host is defaultValue).

I check on org.springframework.boot.logging.logback.LogbackLoggingSystem inside loadConfiguration when I look inside initializationContext.getEnvironment().getProperty("myapp.stash.host") returns null but also initializationContext.getEnvironment().getProperty("spring.application.name") returns bootstrap instead of my spring.application.name. That mean I think is not using my context but Spring cloud bootstrap context (I'm not using Spring cloud config and I don't have any bootstrap.yml inside my classpath)

This message was deleted
I tried the same with fluentd appender but it works... maybe is more logstash-logback-encoder bugs
Dave Syer
@dsyer
Mar 09 2017 11:43
The logging system has to be initialized twice if you use Spring CLoud
Are you sure you are using the latest snapshots?
Thibaud Lepretre
@kakawait
Mar 09 2017 11:44
No i'm using latest stable I will try with snapshots
I can also publish a small sample
Dave Syer
@dsyer
Mar 09 2017 11:45
We released spring-cloud-commons 1.1.8 yesterday, but it's not in a release train yet
Thibaud Lepretre
@kakawait
Mar 09 2017 11:48
still the same with Dalston.BUILD-SNAPSHOT that fetch spring-cloud-commons-1.2.0.BUILD-20170309.085242-1098.jar
You can reproduce by using that sample https://github.com/kakawait/spring-cloud-logstash-issue
Dave Syer
@dsyer
Mar 09 2017 11:57
Thanks
LIN
@magixsource
Mar 09 2017 11:59
@dsyer hi,some sample on github is old now, do you have plan to update that
some API has changed
Dave Syer
@dsyer
Mar 09 2017 12:00
@kakawait that file is going to be used in bootstrap
So if you want it to work, you'll have to configure something in bootstrap.yml that provides valid values
I don't see any way round that
Except to skip the bootstrap, and miss out on all the other features it provides.
@magixsource We run some of those samples as integration tests.
Some of them for sure are not up to date.
But there is no plan to overhaul them wholesale.
If there is one that you care about, fix it and send a PR
LIN
@magixsource
Mar 09 2017 12:03
ok,i got it.
Thibaud Lepretre
@kakawait
Mar 09 2017 12:04
@dsyer OK is what I thought I will do another so
Thibaud Lepretre
@kakawait
Mar 09 2017 12:52
@dsyer just last question if I put my properties on bootstrap.yml, it will work but will I be able to override property inside Spring Cloud Config backend? I never used Spring Cloud Config but I though that bootstrap.yml is loaded before asking to Spring Cloud Config
Dave Syer
@dsyer
Mar 09 2017 12:54
Yes. But that's the point isn't it - to be able to override it.
Thibaud Lepretre
@kakawait
Mar 09 2017 12:54
I think is kind of Ouroboros problem since logging may be launched before Spring Cloud Config client
Dave Syer
@dsyer
Mar 09 2017 12:54
Your logging definitely will be initialized before the config client is ready. It kind of has to be.
Thibaud Lepretre
@kakawait
Mar 09 2017 12:54
ok it's ok for me
Dave Syer
@dsyer
Mar 09 2017 12:54
Otherwise you'd have no logs for the bootstrap phase
Thibaud Lepretre
@kakawait
Mar 09 2017 12:55
I will just change my strategy
I will not use UDP appender just plain old filesystem and I will ask Logstash or Filebeat to retrieve information from that file
I will be easier to operate
Dave Syer
@dsyer
Mar 09 2017 12:56
You can switch the logging config file in bootstrap
But whatever is easier for you is best
Thibaud Lepretre
@kakawait
Mar 09 2017 12:57
Thanks again I will finish my ELK spring cloud test now :)