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

3rd
Apr 2017
Ward Jans
@wjans
Apr 03 2017 06:53 UTC
Hi, is there an easy way to centralise i18n messages in the config server? I tried setting spring.messages.basename=http://localhost:8888/myapp/default/master/i18n/messages which does work, but it takes a couple of minutes to load the message source so I was wondering if there was a better way to achieve this
Dave Syer
@dsyer
Apr 03 2017 07:00 UTC
A couple of minutes?
How many files are you loading?
Ward Jans
@wjans
Apr 03 2017 07:03 UTC
only three very small files, but it seems to be taking a lot of time at org.springframework.core.io.support.PathMatchingResourcePatternResolver#doFindAllClassPathResources
the while (resourceUrls.hasMoreElements()) { is iterating many times and always resolving the same url
Dave Syer
@dsyer
Apr 03 2017 07:29 UTC
Hmm. I guess it would.
You might have to modify that logic. Or cache the files somewhere.
Ward Jans
@wjans
Apr 03 2017 08:56 UTC
Is it possible that it's only the org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration.ResourceBundleCondition that's causing this 'problem'? For modifying the logic I was considering bypassing the autoconfiguration but it seems to me that disabling this condition works fine
Dave Syer
@dsyer
Apr 03 2017 09:09 UTC
That's interesting.
Maybe raise an issue in Spring Boot to make that smarter?
Ward Jans
@wjans
Apr 03 2017 09:14 UTC
Ok, I'll do that
Mark Corkery
@KramKroc
Apr 03 2017 09:51 UTC

Hi folks, quick upgrade question. Moving from Brixton to Camden.SR6 and I’ve unexpectedly encountered an issue using the @EnableCircuitBreaker annotation.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hystrixStreamEndpoint' defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration$HystrixWebConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: com/netflix/hystrix/metric/consumer/HystrixDashboardStream
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar!/:4.3.7.RELEASE]

I turned on debug and noticed the following near the start of program starting:

2017-04-03 10:12:49.752  INFO 44484 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'hystrixFeature' with a different definition: 

replacing 
    [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixWebConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); 

        defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration$HystrixWebConfiguration.class]] 


with 
    [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); 

    defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.class]]
Any ideas what could be the root?
Dave Syer
@dsyer
Apr 03 2017 10:04 UTC
The bean override isn't necessarily connected
Short answer: I don't know.
Mark Corkery
@KramKroc
Apr 03 2017 10:05 UTC
@dsyer I feared it wouldn’t be a quick answer :D
Dave Syer
@dsyer
Apr 03 2017 10:05 UTC
A NoClassDefFoundError usually just means you need something on the classpath and it's not there.
Mark Corkery
@KramKroc
Apr 03 2017 10:05 UTC
Yes
Dave Syer
@dsyer
Apr 03 2017 10:05 UTC
If you use the starter poms from spring cloud you shouldn't have any issues
But It's hard to say without seeing the code
Mark Corkery
@KramKroc
Apr 03 2017 10:09 UTC
Which particular starter would we need for @EnableCircuitBreaker?
We’ve the following:
"org.springframework.boot:spring-boot-starter",
"org.springframework.cloud:spring-cloud-config-client",
"org.springframework.cloud:spring-cloud-starter-eureka",
"org.springframework.cloud:spring-cloud-starter-hystrix”
'org.springframework.boot:spring-boot-starter-web’
'org.springframework.cloud:spring-cloud-config-client’
'org.springframework.cloud:spring-cloud-starter-eureka'
I imagined it would be the hystrix one and we do pull that in
Or even the eureka one?
Dave Syer
@dsyer
Apr 03 2017 11:16 UTC
I guess the hystrix one
Still impossible to diagnose a problem
Can you create a sample?
Mark Corkery
@KramKroc
Apr 03 2017 12:46 UTC
@dsyer We were previously using hystrix-core version 1.5.1
I see that’s up to 1.5.10
when I moved to that version my issues went away!
Dave Syer
@dsyer
Apr 03 2017 12:49 UTC
Why are you managing the version of that dependency?
(That's what I meant by "use the starters")
Mark Corkery
@KramKroc
Apr 03 2017 12:49 UTC
I’ll need to do some archaeology to find that out