spring-cloud / spring-cloud-netflix Goto Github PK
View Code? Open in Web Editor NEWIntegration with Netflix OSS components
Home Page: http://cloud.spring.io/spring-cloud-netflix/
License: Apache License 2.0
Integration with Netflix OSS components
Home Page: http://cloud.spring.io/spring-cloud-netflix/
License: Apache License 2.0
I am trying to run the spring cloud Eureka server using the form java -jar and it throws the following exception. It does work with mvn spring-boot:run. This is not really a deployable solution.
In order to replicate the issue, I took one of the simple spring boot examples and wrapped it with @EnableEurekaServer.
I have packaged up the repeatable issue at github at https://github.com/larry13767/eurekabug
If you build it and run the jar then you will see the same result.
[2014-09-30 23:49:57.698] boot - 76900 INFO [main] --- TomcatEmbeddedServletContainerFactory: Server initialized with port: 8761
[2014-09-30 23:49:57.969] boot - 76900 INFO [main] --- StandardService: Starting service Tomcat
[2014-09-30 23:49:57.970] boot - 76900 INFO [main] --- StandardEngine: Starting Servlet Engine: Apache Tomcat/7.0.55
[2014-09-30 23:49:58.151] boot - 76900 INFO [localhost-startStop-1] --- [/]: Initializing Spring embedded WebApplicationContext
[2014-09-30 23:49:58.152] boot - 76900 INFO [localhost-startStop-1] --- ContextLoader: Root WebApplicationContext: initialization completed in 3364 ms
[2014-09-30 23:49:58.926] boot - 76900 INFO [localhost-startStop-1] --- FilterRegistrationBean: Mapping filter: 'metricsFilter' to: [/]
[2014-09-30 23:49:58.927] boot - 76900 INFO [localhost-startStop-1] --- FilterRegistrationBean: Mapping filter: 'webRequestTraceFilter' to: [/]
[2014-09-30 23:49:58.927] boot - 76900 INFO [localhost-startStop-1] --- FilterRegistrationBean: Mapping filter: 'servletContainer' to urls: [/v2/]
[2014-09-30 23:49:58.927] boot - 76900 INFO [localhost-startStop-1] --- FilterRegistrationBean: Mapping filter: 'hiddenHttpMethodFilter' to: [/]
[2014-09-30 23:49:58.928] boot - 76900 INFO [localhost-startStop-1] --- FilterRegistrationBean: Mapping filter: 'applicationContextIdFilter' to: [/*]
[2014-09-30 23:49:58.928] boot - 76900 INFO [localhost-startStop-1] --- ServletRegistrationBean: Mapping servlet: 'dispatcherServlet' to [/]
ServletContext initialized
[2014-09-30 23:49:59.130] boot - 76900 INFO [localhost-startStop-1] --- PackagesResourceConfig: Scanning for root resource and provider classes in the packages:
com.netflix.discovery
com.netflix.eureka
[2014-09-30 23:49:59.175] boot - 76900 ERROR [localhost-startStop-1] --- [/]: Exception starting filter servletContainer
com.sun.jersey.core.spi.scanning.ScannerException: IO error when scanning jar jar:file:/Users/larrymitchell/rpilprojects/tmp/spring-boot-sample-tomcat/target/spring-boot-sample-tomcat-1.1.7.RELEASE.jar!/lib/eureka-client-1.1.135.jar!/com/netflix/discovery
at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.scan(JarZipSchemeScanner.java:82)
at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:223)
at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:139)
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80)
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
at com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:78)
at com.sun.jersey.api.core.PackagesResourceConfig.(PackagesResourceConfig.java:89)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:727)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:109)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4828)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5508)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: /Users/larrymitchell/rpilprojects/tmp/spring-boot-sample-tomcat/target/spring-boot-sample-tomcat-1.1.7.RELEASE.jar!/lib/eureka-client-1.1.135.jar (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:146)
at java.io.FileInputStream.(FileInputStream.java:101)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1037)
at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.closing(JarZipSchemeScanner.java:123)
at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.scan(JarZipSchemeScanner.java:75)
... 22 more
[2014-09-30 23:49:59.178] boot - 76900 ERROR [localhost-startStop-1] --- StandardContext: Error filterStart
[2014-09-30 23:49:59.180] boot - 76900 ERROR [localhost-startStop-1] --- StandardContext: Context [] startup failed due to previous errors
ServletContext destroyed
Access servo metrics directly (if possible), instead of grabbing them from JMX.
As a client it's really hard to tell what went wrong if the proxy call fails (e.g. if the eureka registration just isn't there). You can tell from metrics/trace that something happened, but it would be nice for the consumer (e.g. browser to get some more immediate feedback). It might be sufficient just to mimic or re-use the Spring Boot default error page behaviour.
Is it available? Are we registered? That kind of thing.
Trying to use spring-cloud-starter-hystrix-dashboard and @EnableHystrixDashboard
see https://github.com/spencergibb/communityanswers/tree/so26450251 for a sample application
The work around is to add @EnableEurekaClient
Fits somewhere above using DiscoveryClient directly and below Feign. E.g. pluggable load-balancing strategy using Spring configuration.
Hi
Trying to figure out how to use the HealthCheckHandler
and HealthCheckHandlerProvider
in DiscoveryClient
with Spring Cloud Netflix and Eureka.
My service registered with Eureka Server is always UP even though my /health
reports: {"status":"DOWN"}
and HTTP 500.
Cannot find that there's any connection between them?
Thanks!
I am noticing that I get a RuntimeException: Bad status: 500
every 5 or so minutes in my logs. The test service I created does seem to connect but this is filling up my logs.
Any idea why this should be happening?
Here is a trace:
2014-10-23 18:06:52.767 INFO 75065 --- [pool-3-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/delta with status code 200.
2014-10-23 18:06:52.770 INFO 75065 --- [pool-3-thread-1] com.netflix.discovery.DiscoveryClient : Completed cache refresh task for discovery. All Apps hash code is Local region apps hashcode: UP_1_, is fetching remote regions? false
2014-10-23 18:06:55.061 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/TESTSERVICE1/127.0.0.1 with status code 500.
2014-10-23 18:06:55.061 WARN 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Action: Renew => returned status of 500 from http://localhost:8761/v2/apps/TESTSERVICE1/127.0.0.1
2014-10-23 18:06:55.062 ERROR 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Can't get a response from http://localhost:8761/v2/apps/TESTSERVICE1/127.0.0.1
Can't contact any eureka nodes - possibly a security group issue?
java.lang.RuntimeException: Bad status: 500
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1114)
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1019)
at com.netflix.discovery.DiscoveryClient.access$400(DiscoveryClient.java:108)
at com.netflix.discovery.DiscoveryClient$HeartbeatThread.run(DiscoveryClient.java:1528)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
2014-10-23 18:06:55.062 ERROR 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : DiscoveryClient_TESTSERVICE1/127.0.0.1 - was unable to send heartbeat!
java.lang.RuntimeException: Bad status: 500
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1114)
at com.netflix.discovery.DiscoveryClient.makeRemoteCall(DiscoveryClient.java:1019)
at com.netflix.discovery.DiscoveryClient.access$400(DiscoveryClient.java:108)
at com.netflix.discovery.DiscoveryClient$HeartbeatThread.run(DiscoveryClient.java:1528)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
2014-10-23 18:07:05.072 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/TESTSERVICE1/127.0.0.1 with status code 404.
2014-10-23 18:07:05.072 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : DiscoveryClient_TESTSERVICE1/127.0.0.1 - Re-registering apps/TESTSERVICE1
2014-10-23 18:07:05.072 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : DiscoveryClient_TESTSERVICE1/127.0.0.1: registering service...
2014-10-23 18:07:05.079 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/TESTSERVICE1 with status code 204.
2014-10-23 18:07:05.080 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : DiscoveryClient_TESTSERVICE1/127.0.0.1 - registration status: 204
2014-10-23 18:07:15.088 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/TESTSERVICE1/127.0.0.1 with status code 200.
2014-10-23 18:07:22.777 INFO 75065 --- [pool-3-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/delta with status code 200.
2014-10-23 18:07:22.779 INFO 75065 --- [pool-3-thread-1] com.netflix.discovery.DiscoveryClient : Completed cache refresh task for discovery. All Apps hash code is Local region apps hashcode: UP_1_, is fetching remote regions? false
2014-10-23 18:07:25.096 INFO 75065 --- [pool-2-thread-1] com.netflix.discovery.DiscoveryClient : Finished a call to service url http://localhost:8761/v2/ and url path apps/TESTSERVICE1/127.0.0.1 with status code 200.
In addition to @EnableZuulProxy
add @EnableZuulServer
A common need, especially for hypermedia APIs, is to rewrite URLs in the response (both body and headers). I realize this is difficult to do for media types with no inherent knowledge of URLs (e.g., plain JSON), but it seems like something many people will end up writing themselves and poorly given the subtleties around RequestContext.responseDataStream
and RequestContext.responseBody
.
Currently eureka-server has a dependency on "org.springframework.boot:spring-boot-starter-log4j" which brings in "log4j:log4j:1.2.17" but "org.springframework.boot:spring-boot-starter-logging" already comes along with "ch.qos.logback:logback-classic:1.1.2".
Could you please get rid of one of the dependencies or exclude one of them in the pom.xml.
As a side note: If you choose log4j, please try to introduce log4j2. The community will be very thankful. ;)
When using a dynamic port (server.port=0) for an eureka client application with @EnableEurekaClient, it will be registered with port=0 at eureka server. It seems that the client registration takes place before the dynamic port has been assigned.
Ribbon 2.0 support will have to wait until RxNetty supports a serialization framework ReactiveX/RxNetty#54.
Has built in support for Hystrix and would replace Feign.
Use LoadBalancerContext
in RibbonInterceptor
or RibbonLoadBalancerClient
to take advantage of business logic in LoadBalancerContext
(such as url construction) and to call methods such as noteRequestCompletion
If I set the Spring Actuator management contextPath to management the hystrix.stream endpoint will end up as /managementhystrix.stream/**
I would expect /management/hystrix.stream/**
The health of the Hystrix breakers should be reported as part of the health actuator; see http://java.dzone.com/articles/hystrix-and-spring-boots for an example.
The Eureka client-server interactions are reasonably robust when you first start everything up (it doesn't matter what order the processes start), but once everything is running, if you kill Eureka and restart it then the apps do not re-register.
Github links in docs are not rendered correctly at the end of the section for: http://projects.spring.io/spring-cloud/spring-cloud.html#_service_discovery_eureka_clients
Would it be possible if the EurekaClientConfiguration
when starting could respect the InstanceStatus
given by a HealthCheckHandler
registered on the DiscoveryClient
?
[2014-10-14 11:18:37.401] boot - 14982 ERROR [Thread-3] --- ConcurrentMapConfiguration: Error firing configuration event
java.util.ConcurrentModificationException
at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:953)
at java.util.LinkedList$ListItr.next(LinkedList.java:886)
at org.springframework.core.env.PropertySourcesPropertyResolver.containsProperty(PropertySourcesPropertyResolver.java:49)
at org.springframework.core.env.AbstractEnvironment.containsProperty(AbstractEnvironment.java:460)
at org.springframework.cloud.netflix.archaius.ConfigurableEnvironmentConfiguration.containsKey(ConfigurableEnvironmentConfiguration.java:43)
at com.netflix.config.ConcurrentCompositeConfiguration.getSource(ConcurrentCompositeConfiguration.java:864)
at com.netflix.config.ConcurrentCompositeConfiguration$1.configurationChanged(ConcurrentCompositeConfiguration.java:151)
at com.netflix.config.ConcurrentMapConfiguration.fireEvent(ConcurrentMapConfiguration.java:312)
at com.netflix.config.ConcurrentMapConfiguration.setProperty(ConcurrentMapConfiguration.java:216)
at com.netflix.config.ConcurrentCompositeConfiguration.setProperty(ConcurrentCompositeConfiguration.java:486)
at com.netflix.eureka.cluster.PeerEurekaNode.getBatcher(PeerEurekaNode.java:800)
at com.netflix.eureka.cluster.PeerEurekaNode.<init>(PeerEurekaNode.java:93)
at com.netflix.eureka.PeerAwareInstanceRegistry.updatePeerEurekaNodes(PeerAwareInstanceRegistry.java:219)
at com.netflix.eureka.PeerAwareInstanceRegistry.setupPeerEurekaNodes(PeerAwareInstanceRegistry.java:187)
at com.netflix.eureka.PeerAwareInstanceRegistry.init(PeerAwareInstanceRegistry.java:156)
at com.netflix.eureka.PeerAwareInstanceRegistry.<init>(PeerAwareInstanceRegistry.java:144)
at com.netflix.eureka.PeerAwareInstanceRegistry.<clinit>(PeerAwareInstanceRegistry.java:130)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:169)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:151)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer$$EnhancerBySpringCGLIB$$75cf6d65.onApplicationEvent(<generated>)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1$1.initEurekaEnvironment(EurekaServerInitializerConfiguration.java:104)
at com.netflix.eureka.EurekaBootStrap.contextInitialized(EurekaBootStrap.java:88)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1.run(EurekaServerInitializerConfiguration.java:97)
at java.lang.Thread.run(Thread.java:744)
According to the Eureka Demo deployed on CF (http://dsyereureka.cfapps.io/) it shows a couple of Application registered with Eureka.
It turns out, that Eureka UI, shows all those Apps with Status UP but apparently one of them is DOWN
If one try to verify the first result
It turns out to be an App that is not running anymore or become an unresponsive App and not accessible anymore on CF, but it still shows with status UP on Eureka.
Not sure if doing something wrong or if this is an issue. The code is pretty much a copy of the code from the samples area or the recent doge microservices webinar.
Apps involved are as follows:
Spring Cloud Config Server
2 Services Account & Person each annotated with @EnableHystrix
Spring Cloud Eureka for registering the services
Spring Cloud Hystrix Dashboard
Config Server is working fine
Registration is working fine.
Hystrix when viewing each individual stream works fine.
The problem is that Turbine will not show information from the two services/applications
application.yml content for turbine
info:
component: Turbine
PREFIX:
endpoints:
restart:
enabled: true
shutdown:
enabled: true
server:
port: 8989
logging:
level: INFO
eureka:
instance:
#Virtual host name by which the clients identifies this service
virtualHostName: ${spring.application.name}
turbine:
aggregator:
clusterConfig: TEST
appConfig: person,account
First question about this config. is clusterConfig an arbitrary name?
I have noticed if I change clusterConfig to PERSON and remove the account appConfig the stream will work with this url: http://localhost:8989/turbine.stream?cluster=PERSON
If I change the cluster name to anything else in the turbine config the stream is empty. And if I add ,account to the appConfig the stream is empty.
Please help or tell me if this is an issue?
As discussed on twitter it'd be cool to merge the archaius-spring-adapter with Spring Cloud.
Ideally, we'd manage to keep the following functionality:
Also it'd also entail very few changes for existing users to port from what we released most recently to the spring-cloud version, but clearly there will be some.
I'm not sure if a pull request is the best way to move this forward, but it would be great if it was. I'm creating this first to start the discussion publicly so we can agree a good way to approach this for all concerned.
(Copying the archaius-spring-adapter team in on this for their reference: @rhart, @nickjwalter, @gaythu-rajan, @sanjaykumar81
Copying in the folks who started all this for their reference too: @mumrah, @chriswhitcombe)
Lets move to 1.1.8 now and 1.2 (milestone at least) for Spring Cloud 1.0.0.M3 if possible.
The unit tests are failing for Eureka
[2014-09-29 21:10:59.190] boot - 25310 INFO [main] --- TomcatEmbeddedServletContainer: Tomcat started on port(s): 49408/http
[2014-09-29 21:10:59.225] boot - 25310 ERROR [Thread-2] --- EurekaBootStrap: Cannot bootstrap eureka server :
java.lang.ExceptionInInitializerError
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:160)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:142)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer$$EnhancerBySpringCGLIB$$300669e6.onApplicationEvent()
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1$1.initEurekaEnvironment(EurekaServerInitializerConfiguration.java:95)
at com.netflix.eureka.EurekaBootStrap.contextInitialized(EurekaBootStrap.java:88)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1.run(EurekaServerInitializerConfiguration.java:88)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalStateException: java.lang.NullPointerException
at com.netflix.eureka.PeerAwareInstanceRegistry.setupPeerEurekaNodes(PeerAwareInstanceRegistry.java:203)
at com.netflix.eureka.PeerAwareInstanceRegistry.init(PeerAwareInstanceRegistry.java:156)
at com.netflix.eureka.PeerAwareInstanceRegistry.(PeerAwareInstanceRegistry.java:144)
at com.netflix.eureka.PeerAwareInstanceRegistry.(PeerAwareInstanceRegistry.java:130)
... 9 more
Caused by: java.lang.NullPointerException
at com.netflix.eureka.PeerAwareInstanceRegistry.updatePeerEurekaNodes(PeerAwareInstanceRegistry.java:212)
at com.netflix.eureka.PeerAwareInstanceRegistry.setupPeerEurekaNodes(PeerAwareInstanceRegistry.java:187)
... 12 more
[2014-09-29 21:10:59.229] boot - 25310 ERROR [Thread-2] --- EurekaServerInitializerConfiguration: Could not initialize Eureka servlet context
java.lang.RuntimeException: Cannot bootstrap eureka server :
at com.netflix.eureka.EurekaBootStrap.contextInitialized(EurekaBootStrap.java:120)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1.run(EurekaServerInitializerConfiguration.java:88)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ExceptionInInitializerError
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:160)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:142)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer$$EnhancerBySpringCGLIB$$300669e6.onApplicationEvent()
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1$1.initEurekaEnvironment(EurekaServerInitializerConfiguration.java:95)
at com.netflix.eureka.EurekaBootStrap.contextInitialized(EurekaBootStrap.java:88)
... 2 more
Caused by: java.lang.IllegalStateException: java.lang.NullPointerException
at com.netflix.eureka.PeerAwareInstanceRegistry.setupPeerEurekaNodes(PeerAwareInstanceRegistry.java:203)
at com.netflix.eureka.PeerAwareInstanceRegistry.init(PeerAwareInstanceRegistry.java:156)
at com.netflix.eureka.PeerAwareInstanceRegistry.(PeerAwareInstanceRegistry.java:144)
at com.netflix.eureka.PeerAwareInstanceRegistry.(PeerAwareInstanceRegistry.java:130)
... 9 more
Caused by: java.lang.NullPointerException
at com.netflix.eureka.PeerAwareInstanceRegistry.updatePeerEurekaNodes(PeerAwareInstanceRegistry.java:212)
at com.netflix.eureka.PeerAwareInstanceRegistry.setupPeerEurekaNodes(PeerAwareInstanceRegistry.java:187)
... 12 more
[2014-09-29 21:10:59.667] boot - 25310 INFO [main] --- DiscoveryClient: Disable delta property : false
[2014-09-29 21:10:59.667] boot - 25310 INFO [main] --- DiscoveryClient: Single vip registry refresh property : null
[2014-09-29 21:10:59.667] boot - 25310 INFO [main] --- DiscoveryClient: Force full registry fetch : false
[2014-09-29 21:10:59.667] boot - 25310 INFO [main] --- DiscoveryClient: Application is null : false
[2014-09-29 21:10:59.668] boot - 25310 INFO [main] --- DiscoveryClient: Registered Applications size is zero : true
[2014-09-29 21:10:59.668] boot - 25310 INFO [main] --- DiscoveryClient: Application version is -1: true
[2014-09-29 21:10:59.848] boot - 25310 INFO [main] --- DiscoveryClient: Finished a call to service url http://localhost:8761/v2/ and url path apps/ with status code 200.
[2014-09-29 21:10:59.849] boot - 25310 INFO [main] --- DiscoveryClient: Getting all instance registry info from the eureka server
[2014-09-29 21:11:00.069] boot - 25310 INFO [main] --- DiscoveryClient: The response status is 200
[2014-09-29 21:11:00.071] boot - 25310 INFO [main] --- DiscoveryClient: Starting heartbeat executor: renew interval is: 30
[2014-09-29 21:11:00.079] boot - 25310 INFO [main] --- EurekaClientConfiguration: Registering application eureka with eureka with status UP
[2014-09-29 21:11:00.081] boot - 25310 INFO [main] --- ForkedBooter: Started ForkedBooter in 9.851 seconds (JVM running for 10.629)
[2014-09-29 21:11:00.347] boot - 25310 INFO [http-nio-auto-1-exec-1] --- [/]: Initializing Spring FrameworkServlet 'dispatcherServlet'
[2014-09-29 21:11:00.348] boot - 25310 INFO [http-nio-auto-1-exec-1] --- DispatcherServlet: FrameworkServlet 'dispatcherServlet': initialization started
[2014-09-29 21:11:00.378] boot - 25310 INFO [http-nio-auto-1-exec-1] --- DispatcherServlet: FrameworkServlet 'dispatcherServlet': initialization completed in 30 ms
Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 10.776 sec <<< FAILURE! - in org.springframework.cloud.netflix.eureka.server.ApplicationTests
catalogLoads(org.springframework.cloud.netflix.eureka.server.ApplicationTests) Time elapsed: 10.463 sec <<< FAILURE!
java.lang.AssertionError: expected:<200> but was:<500>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:743)
at org.junit.Assert.assertEquals(Assert.java:118)
at org.junit.Assert.assertEquals(Assert.java:144)
at org.springframework.cloud.netflix.eureka.server.ApplicationTests.catalogLoads(ApplicationTests.java:47)
Up to now the spring-cloud-samples worked with configserver-first bootstrap - i.e. the config server is the first thing a client app binds to, and then extracts all the data it needs from there to contact everything else (including Eureka).
The way round is also interesting: Eureka is the first thing a client app binds to, and it extracts the config server location from there (or if there is no config server then it gets some other anchor point) before it continues with the rest of the dance. It's slightly less efficient this way (an extra network round trip to locate the config server), but only if you actually need the config server.
Implementation would still be a config client bootstrap process (aPropertySourceLocator
essentially), so it would need to be in a small standalone jar to make it optional.
Use SPEL or some other method to allow configuration of clusterName
rather than overriding. Useful for turbine http stream aggregation (ie ASGName on AWS, vs custom metadata)
If you use pure Netflix APIs you will still be fine, but if you want the Spring Cloud support (e.g. RestTemplate
and LoadBalancerClient
) you will not be able to use the native AWS metadata for zones because we unconditionally squash it in DomainExtractingServerList
.
I have used the DiscoveryClient in some instances and it seems to work fine, however in others it throws a NPE for no reason that I can determine. In all cases my spring boot app is annotated with @EnableEurekaClient
There are occasions when if I auto wire the DiscoveryClient such as
@Autowired
private DiscoveryClient discoveryClient;
and then later I call it via
private InstanceInfo findLockManager() {
InstanceInfo instance = null;
try {
instance = discoveryClient.getNextServerFromEureka(LOCK_MANAGER, false);
} catch (RuntimeException e) {
logger.error("Failed to find service " + LOCK_MANAGER, e);
return null;
}
return instance;
}
While running I see this
java.lang.NullPointerException: null
at com.netflix.discovery.DiscoveryClient$$FastClassBySpringCGLIB$$a84c8cb4.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133)
at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
at com.netflix.discovery.DiscoveryClient$$EnhancerBySpringCGLIB$$4ff799f6.getNextServerFromEureka(<generated>)
at com.cisco.services.rpil.management.NodeStatusManager.findLockManager(NodeStatusManager.java:153)
at com.cisco.services.rpil.management.NodeStatusManager.setGlobalLock(NodeStatusManager.java:170)
at com.cisco.services.rpil.management.NodeStatusManager.startup(NodeStatusManager.java:91)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:300)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at com.cisco.services.rpil.MicroServiceApplication.main(MicroServiceApplication.java:60)
During startup the following exception is seen in the server console log:
[2014-10-07 01:05:14.058] boot - 14859 INFO [localhost-startStop-1] --- PackagesResourceConfig: Scanning for root resource and provider classes in the packages:
com.netflix.discovery
com.netflix.eureka
[2014-10-07 01:05:14.077] boot - 14859 ERROR [localhost-startStop-1] --- [/]: Exception starting filter servletContainer
com.sun.jersey.core.spi.scanning.ScannerException: IO error when scanning jar jar:file:/Users/ahe/dev/innoq/eureka/target/eureka-0.0.1-SNAPSHOT.jar!/lib/eureka-client-1.1.135.jar!/com/netflix/discovery
at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.scan(JarZipSchemeScanner.java:82)
at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:223)
at com.sun.jersey.core.spi.scanning.PackageNamesScanner.scan(PackageNamesScanner.java:139)
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80)
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:89)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:700)
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:678)
at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:203)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:374)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:727)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:109)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: /Users/ahe/dev/innoq/eureka/target/eureka-0.0.1-SNAPSHOT.jar!/lib/eureka-client-1.1.135.jar (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at java.io.FileInputStream.<init>(FileInputStream.java:93)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
at java.net.URL.openStream(URL.java:1038)
at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.closing(JarZipSchemeScanner.java:123)
at com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner.scan(JarZipSchemeScanner.java:75)
... 22 more
[2014-10-07 01:05:14.080] boot - 14859 ERROR [localhost-startStop-1] --- StandardContext: Error filterStart
[2014-10-07 01:05:14.081] boot - 14859 ERROR [localhost-startStop-1] --- StandardContext: Context [] startup failed due to previous errors
steps to reproduce
git clone [email protected]:spring-cloud-samples/eureka.git
cd eureka
mvn clean package
java -jar target/eureka-0.0.1-SNAPSHOT.jar
Run with Java8 (1.8.0_20-ea-b23)
the hystrix-dashboard index.html is not working correctly, if a context path is set, because the following src url is not considering the context path:
<script src="/webjars/jquery/2.1.1/jquery.min.js" type="text/javascript"></script>
Same for the hystrix-monitor-dashboard.
Requires changes to NetflixOSS logging. See Netflix/blitz4j#10.
The issue is that Eureka is designed to be conservative and if it loses contact with its peers it thinks there might be a network problem and switches off its own ability to cancel leases (in case the service is actually alive and it just doesn't know). One way to override is to set
eureka:
server:
enableSelfPreservation: false
but that also makes Eureka think you are trying to sabotage it and it gets red and angry.
Another part of the issue is that Eureka in standalone mode (like we've used it up to now) will never recognise instances as being in the same AZ, and hence will never count the registrations as "live"1. Without the flag above, only when the renewal rate is high (exceeding a threshold calculated from the number of "live" instances) will dead instances be cancelled automatically2. Seems like a good idea, but if there are 0 live instances, the threshold is never exceeded. Currently there can only be live instances if they have EurekaInstanceConfig
with AmazonInfo
in their dataCenterInfo
, and it's hard to fake because of some assumptions about AWS internals (the existence of EIP in particular, and the format of public hostnames).
Even though the apps are connecting, registering and renewing their leases you get a lot of warning logs in the Eureka console.
/admin/metrics is the same
specifically for cloud foundry, but could be generally useful
I saw a stack trace from navbar.ftl when amazonInfo was true but one of the associated values was null.
Like the /configprops endpoint but for native Netflix OSS components (e.g. Ribbon loadbalancer properties).
Hystrix starts up a number of thread pools which live outside of the standard Spring beans (see HystrixConcurrencyStrategy). Something, probably the aspect, should make sure that the pools are correctly cleaned up at the appropriate time by calling Hystrix.reset().
When implementing a Feign client as per (http://projects.spring.io/spring-cloud/spring-cloud.html#_declarative_rest_client_feign) using the following interface all GET requests to "getStore" are actually being attempted as POST requests resulting in an Unsupported Operation exception being thrown.
The listPlatforms call is executed as a GET request and works as expected.
Interface;
public interface PlatformClient {
@RequestMapping(method = RequestMethod.GET, value = "/platforms")
List getPlatforms();
@RequestMapping(method = RequestMethod.GET, value = "/platforms/{platformId}")
Platform getStore(@PathVariable("platformId") String platformId);
}
Exception;
Caused by: feign.FeignException: status 405 reading PlatformRestClient#getPlatform(String); content:
Ribbon has a lot of ZoneAvoidance*
and ZoneAffinity*
but at the end of the day there isn't a load balancer that prefers the same zone as the client (unless it happens to be more healthy than the others).
Zones and regions (and data center info in general) are something of a vexed topic for Spring Cloud because the existing implementations of Eureka (in particular) and Ribbon are quite AWS specific. They want you to use the AwsInfo
for the EurekaInstanceConfig
data center info, but if you do that you really do have to be in AWS with access to the APIs (i.e. not in a container) so you can discover your metadata.
It might be nice to get the stacktrace once, but the amount of error logging is out of control if you are working on a eureka client locally and the service is not available. Or even if it is, actually: I only want to it to log when it has a status change really, not on every heartbeat.
Rather than retrieving the Hystrix metrics from the HystrixMetricsPoller
, the metrics should be retrieved directly from the HystrixCommandMetrics
. By using the poller, it means that the data is having to go from HystrixCommandMetrics
-> JSON -> parsing JSON in HystrixMetricsPollerConfiguration
-> GaugeService
.
Currently the turbine and hystrix module have a dependency to the spring-cloud-starters module, which makes it impossible to build the project because the starts itself have a dependency to the netflix module.
Therefore IMHO it makes sense to remove the dependency in the hystrix module entirely (not use) and
remove it in the turbine module and replace it with
org.springframework.cloud
spring-cloud-netflix-core
Note: In order to test it you have to wipe the local maven artifacts before running the build
Eureka peer awareness seems heavily tied to AWS - it only considers apps for registering with peers if it thinks they are not-local, and the way it determines that is through data center info that can only come from AWS APIs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.