Hazelcast cluster not available on Eureka - spring-boot

I had a problem configuring simple Hazelcast cluster for existing Eureka client.
My application is simple Java SpringBoot application with Eureka discovery enabled, it is properly available for Eureka, however Hazelcast cluster is not.
This is my configuration:
hazelcast.xml
<hazelcast
xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.9.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<properties>
<property name="hazelcast.discovery.enabled">true</property>
<property name="hazelcast.jmx">true</property>
<property name="hazelcast.http.healthcheck.enabled">true</property>
<property name="hazelcast.rest.enabled">true</property>
<property name="hazelcast.logging.type">slf4j</property>
<property name="hazelcast.diagnostics.enabled">true</property>
<property name="hazelcast.diagnostics.metric.level">info</property>
<property name="hazelcast.name">hazelcast-cluster</property>
</properties>
<group>
<name>xxxx</name>
<password>xx</password>
</group>
<instance-name>hazelcast-cluster</instance-name>
<network>
<join>
<multicast enabled="false"/>
<tcp-ip enabled="false"/>
<aws enabled="false"/>
<discovery-strategies>
<discovery-strategy class="com.hazelcast.eureka.one.EurekaOneDiscoveryStrategy" enabled="true">
<properties>
<property name="self-registration">true</property>
<property name="namespace">hazelcast</property>
</properties>
</discovery-strategy>
</discovery-strategies>
</join>
</network>
maps....
</hazelcast>
Spring boot application:
#SpringBootApplication
#EnableAutoConfiguration ( exclude = { WebMvcAutoConfiguration.class } )
#EnableDiscoveryClient
#EnableEurekaClient
public class HazelcastClusterApplication {
public static void main( String[] args ) {
SpringApplication.run( HazelcastClusterApplication.class, args );
}
}
Configuration class:
#Configuration
public class HazelcastInstanceConfiguration {
#Bean
public HazelcastInstance hazelcastInstance(Config config, EurekaClient eurekaClient) {
EurekaOneDiscoveryStrategyFactory.setEurekaClient( eurekaClient );
return Hazelcast.newHazelcastInstance(config);
}
#Bean
public Config config() {
Config config = new ClasspathXmlConfig( "hazelcast.xml" );
return config;
}
}
bootstrap.yml
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8011/eureka/
register-with-eureka: true
spring:
mvc:
favicon:
enabled: false
application:
name: cache-server
cloud:
config:
discovery:
enabled: true
serviceId: config-server
failFast: false
retry:
initialInterval: 10000
maxInterval: 60000
maxAttempts: 12
multiplier: 10.1
config:
name: application.*, ${spring.application.name}*.*
server:
port: 7990
Maven dependencies:
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-spring</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-eureka-one</artifactId>
<version>1.0.2</version>
</dependency>
After running, 'cache-server' application is available on Eureka, however I guess also 'hazelcast-cluster' should be available, but it is not. Or my assumption is wrong?
Startup logs:
INFO 17628 --- [ main] c.h.s.d.integration.DiscoveryService : [10.230.115.128]:5701 [xxxx] [3.11] Waiting for registration with Eureka...
INFO 17628 --- [ main] c.h.s.d.integration.DiscoveryService : [10.230.115.128]:5701 [xxxx] [3.11] Waiting for registration with Eureka...
INFO 17628 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_CACHE-SERVER/pc_data:cache-server:7990: registering service...
INFO 17628 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_CACHE-SERVER/pc_data:cache-server:7990 - registration status: 204
INFO 17628 --- [ main] c.h.s.d.integration.DiscoveryService : [10.230.115.128]:5701 [xxxx] [3.11] Waiting for registration with Eureka...
DEBUG 17628 --- [ main] c.h.i.cluster.impl.DiscoveryJoiner : [10.230.115.128]:5701 [xxxx] [3.11] This node will assume master role since no possible member where connected to.
DEBUG 17628 --- [ main] c.h.internal.cluster.ClusterService : [10.230.115.128]:5701 [xxxx] [3.11] Setting master address to [10.230.115.128]:5701
DEBUG 17628 --- [ main] c.h.i.cluster.impl.MembershipManager : [10.230.115.128]:5701 [xxxx] [3.11] Local member list join version is set to 1
DEBUG 17628 --- [ main] c.h.i.cluster.impl.DiscoveryJoiner : [10.230.115.128]:5701 [xxxx] [3.11] PostJoin master: [10.230.115.128]:5701, isMaster: true
INFO 17628 --- [ main] c.h.internal.cluster.ClusterService : [10.230.115.128]:5701 [xxxx] [3.11]
Members {size:1, ver:1} [
Member [10.230.115.128]:5701 - f6ed031e-5740-4daa-b583-5b91d98816c2 this
]
And then my cache-server application is available on Eureka, but not hazelcast-cluster as I guess it should.
Hazelcast client service logs (cutted):
2018-12-11 09:48:01.673 INFO [security-service,,,] 21496 --- [ main] com.hazelcast.client.HazelcastClient : hz.client_0 [xxxx] [3.11] A non-empty group password is configured for the Hazelcast client. Starting with Hazelcast version 3.11, clients with the same group name, but with different group passwords (that do not use authentication) will be accepted to a cluster. The group password configuration will be removed completely in a future release.
2018-12-11 09:48:01.700 INFO [security-service,,,] 21496 --- [ main] com.hazelcast.core.LifecycleService : hz.client_0 [xxxx] [3.11] HazelcastClient 3.11 (20181023 - 1500bbb) is STARTING
2018-12-11 09:48:03.233 INFO [security-service,,,] 21496 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2018-12-11 09:48:03.249 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2018-12-11 09:48:03.264 INFO [security-service,,,] 21496 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2018-12-11 09:48:03.266 INFO [security-service,,,] 21496 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2018-12-11 09:48:03.267 INFO [security-service,,,] 21496 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2018-12-11 09:48:03.267 INFO [security-service,,,] 21496 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2018-12-11 09:48:03.417 INFO [security-service,,,] 21496 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2018-12-11 09:48:03.421 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2018-12-11 09:48:03.421 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2018-12-11 09:48:03.422 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2018-12-11 09:48:03.422 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2018-12-11 09:48:03.423 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2018-12-11 09:48:03.424 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2018-12-11 09:48:03.424 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2018-12-11 09:48:03.426 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
2018-12-11 09:48:03.426 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 5
2018-12-11 09:48:03.426 INFO [security-service,,,] 21496 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2018-12-11 09:48:03.442 INFO [security-service,,,] 21496 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1544518083442 with initial instances count: 3
2018-12-11 09:48:03.488 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:08.468 INFO [security-service,,,] 21496 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SECURITY-SERVICE/GPLPLW2002.gft.com:security-service:8035 - Re-registering apps/SECURITY-SERVICE
2018-12-11 09:48:08.468 INFO [security-service,,,] 21496 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SECURITY-SERVICE/GPLPLW2002.gft.com:security-service:8035: registering service...
2018-12-11 09:48:08.499 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:08.530 INFO [security-service,,,] 21496 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SECURITY-SERVICE/GPLPLW2002.gft.com:security-service:8035 - registration status: 204
2018-12-11 09:48:13.500 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:18.503 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:23.512 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:28.513 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:33.515 INFO [security-service,,,] 21496 --- [ main] c.h.s.d.integration.DiscoveryService : hz.client_0 [xxxx] [3.11] Waiting for registration with Eureka...
2018-12-11 09:48:33.557 INFO [security-service,,,] 21496 --- [ main] c.h.client.spi.ClientInvocationService : hz.client_0 [xxxx] [3.11] Running with 2 response threads
2018-12-11 09:48:33.742 INFO [security-service,,,] 21496 --- [ main] com.hazelcast.core.LifecycleService : hz.client_0 [xxxx] [3.11] HazelcastClient 3.11 (20181023 - 1500bbb) is STARTED
2018-12-11 09:48:33.772 DEBUG [security-service,,,] 21496 --- [ main] c.h.i.networking.nio.NioNetworking : hz.client_0 [xxxx] [3.11] TcpIpConnectionManager configured with Non Blocking IO-threading model: 1 input threads and 1 output threads
2018-12-11 09:48:33.774 DEBUG [security-service,,,] 21496 --- [ main] c.h.i.networking.nio.NioNetworking : hz.client_0 [xxxx] [3.11] IO threads selector mode is SELECT
2018-12-11 09:48:33.818 WARN [security-service,,,] 21496 --- [ient_0.cluster-] c.h.c.c.ClientConnectionManager : hz.client_0 [xxxx] [3.11] Unable to get alive cluster connection, try in 3000 ms later, attempt 1 of 2.
2018-12-11 09:48:36.822 WARN [security-service,,,] 21496 --- [ient_0.cluster-] c.h.c.c.ClientConnectionManager : hz.client_0 [xxxx] [3.11] Unable to get alive cluster connection, attempt 2 of 2.
2018-12-11 09:48:36.824 WARN [security-service,,,] 21496 --- [ient_0.cluster-] c.h.c.c.ClientConnectionManager : hz.client_0 [xxxx] [3.11] Could not connect to cluster, shutting down the client. Unable to connect to any address! The following addresses were tried: []
2018-12-11 09:48:36.828 INFO [security-service,,,] 21496 --- [clientShutdown-] com.hazelcast.core.LifecycleService : hz.client_0 [xxxx] [3.11] HazelcastClient 3.11 (20181023 - 1500bbb) is SHUTTING_DOWN
2018-12-11 09:48:36.839 INFO [security-service,,,] 21496 --- [clientShutdown-] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2018-12-11 09:48:36.843 INFO [security-service,,,] 21496 --- [clientShutdown-] com.netflix.discovery.DiscoveryClient : Unregistering ...
2018-12-11 09:48:36.844 WARN [security-service,,,] 21496 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: o.....org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'cacheManager' defined in class path resource
.......
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [xxxx/hazelcast/HazelcastClientConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Unable to connect to any address! The following addresses were tried: []
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
... 150 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is java.lang.IllegalStateException: Unable to connect to any address! The following addresses were tried: []
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 163 common frames omitted
Caused by: java.lang.IllegalStateException: Unable to connect to any address! The following addresses were tried: []
at com.hazelcast.client.connection.nio.ClusterConnector.connectToClusterInternal(ClusterConnector.java:206)
at com.hazelcast.client.connection.nio.ClusterConnector.access$400(ClusterConnector.java:56)
at com.hazelcast.client.connection.nio.ClusterConnector$2.call(ClusterConnector.java:215)
at com.hazelcast.client.connection.nio.ClusterConnector$2.call(ClusterConnector.java:211)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:64)
at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:80)
What is wrong with my configuration, is this a server problem or client?
Client configuration:
#Bean
#Autowired
public HazelcastInstance hazelcastInstance( EurekaClient eurekaClient, GroupConfig groupConfig ) {
EurekaOneDiscoveryStrategyFactory.setEurekaClient( eurekaClient );
ClientConfig config = new ClientConfig();
config.setGroupConfig( groupConfig );
config.setProperty( "hazelcast.discovery.enabled", "true" );
DiscoveryStrategyConfig discoveryStrategyConfig = new DiscoveryStrategyConfig( new EurekaOneDiscoveryStrategyFactory() );
discoveryStrategyConfig.addProperty( "use-classpath-eureka-client-props", "false" );
discoveryStrategyConfig.addProperty( "self-registration", "false" );
DiscoveryConfig discoveryConfig = new DiscoveryConfig();
discoveryConfig.addDiscoveryStrategyConfig( discoveryStrategyConfig );
config.getNetworkConfig().setDiscoveryConfig( discoveryConfig );
return HazelcastClient.newHazelcastClient( config );
}

The problem is that you use the same EurekaClient for you app discovery (port 7990) and your Hazelcast discovery (port 5701). For more information, read the related GH issue.
You can solve it in two ways:
Use the property use-metadata-for-host-and-port as described here
Use separate Eureka Client and ports for your app and Hazelcast
EDIT: The use-metadata-for-host-and-port will be released in hazelcast-eureka:1.0.3 soon. I've also prepared Hazelcast Eureka Code Sample.

Have you seen the example configs in Eureka plugin repo and also the code sample with Eureka? I see there are some differences in the configs with yours. Please check and let me know if you still have problems.

Related

Eureka Application starts up clean but browser gets 404 (Application is not being hosted at the expected address)?

Full log of startup is below.
When I navigate to:
http://localhost:8010/eureka
there is no log output of the event so obviously the address is bad.
...
...
My URL defined in POM is
eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka
...
...
PLEASE NOTE:
I have VirtualBox and 2 virtual ethernet adapters (that haven't even caused an issue with any springboot app before, but this is my first time running Eureka)
...
...
Console log output at startup:
2019-10-18 13:35:29.693 INFO 10428 --- [ main] .p.d.PhotoAppDiscoveryServiceApplication : No active profile set, falling back to default profiles: default
2019-10-18 13:35:30.195 WARN 10428 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2019-10-18 13:35:30.356 INFO 10428 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=829b0077-09b9-383d-8219-ef5903892aeb
2019-10-18 13:35:30.415 INFO 10428 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$cee4ddf2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-10-18 13:35:30.597 INFO 10428 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8010 (http)
2019-10-18 13:35:30.616 INFO 10428 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-10-18 13:35:30.617 INFO 10428 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.26]
2019-10-18 13:35:30.724 INFO 10428 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-10-18 13:35:30.724 INFO 10428 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1019 ms
2019-10-18 13:35:30.799 WARN 10428 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-10-18 13:35:30.799 INFO 10428 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-10-18 13:35:30.805 INFO 10428 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration#166c2c17
2019-10-18 13:35:32.263 INFO 10428 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-10-18 13:35:32.470 INFO 10428 --- [ main] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.1 03/11/2016 02:08 PM'
2019-10-18 13:35:32.518 INFO 10428 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-10-18 13:35:32.519 INFO 10428 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/C:/Users/user/.m2/repository/com/thoughtworks/xstream/xstream/1.4.10/xstream-1.4.10.jar) to field java.util.TreeMap.comparator
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-10-18 13:35:32.606 INFO 10428 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-10-18 13:35:32.606 INFO 10428 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-10-18 13:35:32.880 WARN 10428 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-10-18 13:35:32.880 INFO 10428 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-10-18 13:35:33.005 INFO 10428 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-10-18 13:35:34.458 INFO 10428 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2019-10-18 13:35:34.550 INFO 10428 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-10-18 13:35:34.568 INFO 10428 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-10-18 13:35:34.568 INFO 10428 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data.
2019-10-18 13:35:34.573 INFO 10428 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1571416534572 with initial instances count: 0
2019-10-18 13:35:34.595 INFO 10428 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initializing ...
2019-10-18 13:35:34.596 WARN 10428 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : The replica size seems to be empty. Check the route 53 DNS Registry
2019-10-18 13:35:34.606 INFO 10428 --- [ main] c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: []
2019-10-18 13:35:34.607 INFO 10428 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initialized
2019-10-18 13:35:34.615 INFO 10428 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-10-18 13:35:34.669 INFO 10428 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application DISCOVERYSERVICE with eureka with status UP
2019-10-18 13:35:34.671 INFO 10428 --- [ Thread-10] o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration..
2019-10-18 13:35:34.673 INFO 10428 --- [ Thread-10] o.s.c.n.e.server.EurekaServerBootstrap : Eureka data center value eureka.datacenter is not set, defaulting to default
2019-10-18 13:35:34.673 INFO 10428 --- [ Thread-10] o.s.c.n.e.server.EurekaServerBootstrap : Eureka environment value eureka.environment is not set, defaulting to test
2019-10-18 13:35:34.680 INFO 10428 --- [ Thread-10] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false
2019-10-18 13:35:34.681 INFO 10428 --- [ Thread-10] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context
2019-10-18 13:35:34.681 INFO 10428 --- [ Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node
2019-10-18 13:35:34.681 INFO 10428 --- [ Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1
2019-10-18 13:35:34.681 INFO 10428 --- [ Thread-10] c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP
2019-10-18 13:35:34.689 INFO 10428 --- [ Thread-10] e.s.EurekaServerInitializerConfiguration : Started Eureka Server
2019-10-18 13:35:34.703 INFO 10428 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8010 (http) with context path ''
2019-10-18 13:35:34.704 INFO 10428 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8010
2019-10-18 13:35:34.706 INFO 10428 --- [ main] .p.d.PhotoAppDiscoveryServiceApplication : Started PhotoAppDiscoveryServiceApplication in 7.989 seconds (JVM running for 8.689)
2019-10-18 13:35:36.892 INFO 10428 --- [on(1)-127.0.0.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-10-18 13:35:36.892 INFO 10428 --- [on(1)-127.0.0.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-10-18 13:35:36.903 INFO 10428 --- [on(1)-127.0.0.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 11 ms
My App:
#SpringBootApplication
#EnableEurekaServer // "stands up a registry that other applications can talk to" https://spring.io/guides/gs/service-registration-and-discovery/
public class PhotoAppDiscoveryServiceApplication {
public static void main(String[] args) {
SpringApplication.run(PhotoAppDiscoveryServiceApplication.class, args);
}
}
My application.properties:
server.port=8010
spring.application.name=discoveryservice
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.client.serviceUrl.defaultZone = http://localhost:8010/eureka
The defaultZone http://localhost:8010 does not host the dashboard.
http://localhost:8010 hosts the dashboard.
http://localhost:8010/eureka
is the URL for Discovery Service Replicas. In this example there is only one instance of Eureka and this is it's address.
https://cloud.spring.io/spring-cloud-netflix/multi/multi__service_discovery_eureka_clients.html
please try with this. because the defaultZone should be in camel case. and server-url should with underscore.
eureka.client.service-url.defaultZone=http://localhost:8010/eureka

2 Hazelcast Members per Spring Boot Instance

I am using Hazelcast as a Hibernate 2LC provider in my Spring Boot application in the embedded/P2P mode. Upon starting the application I could see that two members for my Hazelcast cluster are created. When I start a second instance of my whole application, another two members are created.
Currently, I use the following configuration with HazelcastCacheRegionFactory (not local).
spring.jpa.properties.hibernate.cache.use_second_level_cache=true
spring.jpa.properties.hibernate.cache.region.factory_class=com.hazelcast.hibernate.HazelcastCacheRegionFactory
spring.jpa.properties.hibernate.generate_statistics=true
In the Hazelcast management centre, it looks like one member is the double of the other one. However, when starting a second instance of my Spring Boot application, both member still exist and in total they increase to four.
I already tried to set the backup count to 0 in my hazelcast.xml.
When starting the first instance of my application, I get the following logs:
2019-10-09 12:04:51.055 WARN 21088 --- [ restartedMain] c.h.instance.HazelcastInstanceFactory : Hazelcast is starting in a Java modular environment (Java 9 and newer) but without proper access to required Java packages. Use additional Java arguments to provide Hazelcast access to Java internal API. The internal API access is used to get the best performance results. Arguments to be used:
--add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED
2019-10-09 12:04:51.058 INFO 21088 --- [ restartedMain] c.h.config.AbstractConfigLocator : Loading 'hazelcast.xml' from the classpath.
2019-10-09 12:04:51.238 WARN 21088 --- [ restartedMain] c.h.config.AbstractXmlConfigHelper : Name of the hazelcast schema location is incorrect, using default
2019-10-09 12:04:51.717 INFO 21088 --- [ restartedMain] com.hazelcast.instance.AddressPicker : [LOCAL] [dev] [3.12.2] Prefer IPv4 stack is true, prefer IPv6 addresses is false
2019-10-09 12:04:53.004 INFO 21088 --- [ restartedMain] com.hazelcast.instance.AddressPicker : [LOCAL] [dev] [3.12.2] Picked [10.29.47.243]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
2019-10-09 12:04:53.016 INFO 21088 --- [ restartedMain] com.hazelcast.system : [10.29.47.243]:5701 [dev] [3.12.2] Hazelcast 3.12.2 (20190802 - e34b163) starting at [10.29.47.243]:5701
2019-10-09 12:04:53.016 INFO 21088 --- [ restartedMain] com.hazelcast.system : [10.29.47.243]:5701 [dev] [3.12.2] Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
2019-10-09 12:04:53.240 INFO 21088 --- [ restartedMain] c.h.s.i.o.impl.BackpressureRegulator : [10.29.47.243]:5701 [dev] [3.12.2] Backpressure is disabled
2019-10-09 12:04:55.174 INFO 21088 --- [ restartedMain] com.hazelcast.instance.Node : [10.29.47.243]:5701 [dev] [3.12.2] Creating MulticastJoiner
2019-10-09 12:04:55.313 INFO 21088 --- [ restartedMain] c.h.s.i.o.impl.OperationExecutorImpl : [10.29.47.243]:5701 [dev] [3.12.2] Starting 4 partition threads and 3 generic threads (1 dedicated for priority tasks)
2019-10-09 12:04:55.314 INFO 21088 --- [ restartedMain] c.h.internal.diagnostics.Diagnostics : [10.29.47.243]:5701 [dev] [3.12.2] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
2019-10-09 12:04:55.328 INFO 21088 --- [ restartedMain] com.hazelcast.core.LifecycleService : [10.29.47.243]:5701 [dev] [3.12.2] [10.29.47.243]:5701 is STARTING
2019-10-09 12:04:57.466 INFO 21088 --- [ restartedMain] c.h.internal.cluster.ClusterService : [10.29.47.243]:5701 [dev] [3.12.2]
Members {size:1, ver:1} [
Member [10.29.47.243]:5701 - bf933bd9-9214-4022-a104-514bc5f56267 this
]
2019-10-09 12:04:57.486 INFO 21088 --- [ restartedMain] c.h.i.m.ManagementCenterService : [10.29.47.243]:5701 [dev] [3.12.2] Hazelcast will connect to Hazelcast Management Center on address:
http://localhost:8080/hazelcast-mancenter
2019-10-09 12:04:57.495 INFO 21088 --- [ restartedMain] com.hazelcast.core.LifecycleService : [10.29.47.243]:5701 [dev] [3.12.2] [10.29.47.243]:5701 is STARTED
2019-10-09 12:04:57.544 INFO 21088 --- [MC.State.Sender] com.hazelcast.client.impl.ClientEngine : [10.29.47.243]:5701 [dev] [3.12.2] Applying a new client selector :ClientSelector{any}
2019-10-09 12:04:57.651 INFO 21088 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-10-09 12:04:58.089 INFO 21088 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-10-09 12:04:58.163 INFO 21088 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-10-09 12:04:58.274 INFO 21088 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.10.Final}
2019-10-09 12:04:58.276 INFO 21088 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-10-09 12:04:58.533 INFO 21088 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-10-09 12:04:58.777 INFO 21088 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2019-10-09 12:04:59.122 INFO 21088 --- [ restartedMain] c.h.h.HazelcastCacheRegionFactory : Starting up HazelcastCacheRegionFactory
2019-10-09 12:04:59.124 INFO 21088 --- [ restartedMain] c.h.config.AbstractConfigLocator : Loading 'hazelcast.xml' from the classpath.
2019-10-09 12:04:59.127 WARN 21088 --- [ restartedMain] c.h.config.AbstractXmlConfigHelper : Name of the hazelcast schema location is incorrect, using default
2019-10-09 12:04:59.165 INFO 21088 --- [ restartedMain] com.hazelcast.instance.AddressPicker : [LOCAL] [dev] [3.12.2] Prefer IPv4 stack is true, prefer IPv6 addresses is false
2019-10-09 12:04:59.949 INFO 21088 --- [ restartedMain] com.hazelcast.instance.AddressPicker : [LOCAL] [dev] [3.12.2] Picked [10.29.47.243]:5703, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5703], bind any local is true
2019-10-09 12:04:59.950 INFO 21088 --- [ restartedMain] com.hazelcast.system : [10.29.47.243]:5703 [dev] [3.12.2] Hazelcast 3.12.2 (20190802 - e34b163) starting at [10.29.47.243]:5703
2019-10-09 12:04:59.950 INFO 21088 --- [ restartedMain] com.hazelcast.system : [10.29.47.243]:5703 [dev] [3.12.2] Copyright (c) 2008-2019, Hazelcast, Inc. All Rights Reserved.
2019-10-09 12:04:59.956 INFO 21088 --- [ restartedMain] c.h.s.i.o.impl.BackpressureRegulator : [10.29.47.243]:5703 [dev] [3.12.2] Backpressure is disabled
2019-10-09 12:05:01.343 INFO 21088 --- [ restartedMain] com.hazelcast.instance.Node : [10.29.47.243]:5703 [dev] [3.12.2] Creating MulticastJoiner
2019-10-09 12:05:01.348 INFO 21088 --- [ restartedMain] c.h.s.i.o.impl.OperationExecutorImpl : [10.29.47.243]:5703 [dev] [3.12.2] Starting 4 partition threads and 3 generic threads (1 dedicated for priority tasks)
2019-10-09 12:05:01.349 INFO 21088 --- [ restartedMain] c.h.internal.diagnostics.Diagnostics : [10.29.47.243]:5703 [dev] [3.12.2] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
2019-10-09 12:05:01.349 INFO 21088 --- [ restartedMain] com.hazelcast.core.LifecycleService : [10.29.47.243]:5703 [dev] [3.12.2] [10.29.47.243]:5703 is STARTING
2019-10-09 12:05:01.473 INFO 21088 --- [ restartedMain] c.h.i.cluster.impl.MulticastJoiner : [10.29.47.243]:5703 [dev] [3.12.2] Trying to join to discovered node: [10.29.47.243]:5701
2019-10-09 12:05:01.478 INFO 21088 --- [cached.thread-2] com.hazelcast.nio.tcp.TcpIpConnector : [10.29.47.243]:5703 [dev] [3.12.2] Connecting to /10.29.47.243:5701, timeout: 10000, bind-any: true
2019-10-09 12:05:01.486 INFO 21088 --- [.IO.thread-in-0] com.hazelcast.nio.tcp.TcpIpConnection : [10.29.47.243]:5701 [dev] [3.12.2] Initialized new cluster connection between /10.29.47.243:5701 and /10.29.47.243:51948
2019-10-09 12:05:01.487 INFO 21088 --- [.IO.thread-in-0] com.hazelcast.nio.tcp.TcpIpConnection : [10.29.47.243]:5703 [dev] [3.12.2] Initialized new cluster connection between /10.29.47.243:51948 and /10.29.47.243:5701
2019-10-09 12:05:07.483 INFO 21088 --- [ration.thread-0] c.h.internal.cluster.ClusterService : [10.29.47.243]:5701 [dev] [3.12.2]
Members {size:2, ver:2} [
Member [10.29.47.243]:5701 - bf933bd9-9214-4022-a104-514bc5f56267 this
Member [10.29.47.243]:5703 - 9862ded6-c26d-4da8-929f-f8616a4bf633
]
2019-10-09 12:05:07.489 INFO 21088 --- [ration.thread-0] c.h.internal.cluster.ClusterService : [10.29.47.243]:5703 [dev] [3.12.2]
Members {size:2, ver:2} [
Member [10.29.47.243]:5701 - bf933bd9-9214-4022-a104-514bc5f56267
Member [10.29.47.243]:5703 - 9862ded6-c26d-4da8-929f-f8616a4bf633 this
]
2019-10-09 12:05:08.481 WARN 21088 --- [ restartedMain] com.hazelcast.instance.Node : [10.29.47.243]:5703 [dev] [3.12.2] Config seed port is 5701 and cluster size is 2. Some of the ports seem occupied!
2019-10-09 12:05:08.482 INFO 21088 --- [ restartedMain] c.h.i.m.ManagementCenterService : [10.29.47.243]:5703 [dev] [3.12.2] Hazelcast will connect to Hazelcast Management Center on address:
http://localhost:8080/hazelcast-mancenter
2019-10-09 12:05:08.487 INFO 21088 --- [ restartedMain] com.hazelcast.core.LifecycleService : [10.29.47.243]:5703 [dev] [3.12.2] [10.29.47.243]:5703 is STARTED
How could I solve the issue of having two members per application instance? Is there an actual use of having two members per instance?
Solution by #Mesut
I added the following statement in the application.properties file of Spring Boot (config could be placed elsewhere).
spring.jpa.properties.hibernate.cache.hazelcast.instance_name=your-instance-name
You also have to create a bean with the name 'your-instance-name'. In Spring Boot this could be achieved by annotating a method which returns a Hazelcast instance with #Bean. This could be done in your main class or a #Configuration class.
#Bean
public Config hazelcastConfig() {
Config config = new Config();
config.setInstanceName("your-instance-name");
config.setProperty("hazelcast.phone.home.enabled", "false");
return config;
}
#Bean
public HazelcastInstance hazelcastInstance(Config config) {
return Hazelcast.newHazelcastInstance(config);
}
This results in having only one member per instance of your application (very good). However, the connection to the management centre does not work anymore (not that important in my situation).
If you wanna share the same instance, you should be using the same instance name in both hibernate config and hazelcast.xml.
hibernate.cache.hazelcast.instance_name is the configuration parameter in hibernate side.
You can check documentation here for more info.

Spring cloud Turbine service is not subscribed on Rabbit stream

In my spring cloud application I want configure turbine service for dashboard. Example below:
server:
port: 0
turbine:
amqp:
port: 8989
---
spring:
profiles: docker
rabbitmq:
host: rabbitmq
turbine:
clusterNameExpression: new String("default")
appConfig: card-statement
combineHostPort: true
eureka:
instance:
preferIpAddress: true
client:
serviceUrl:
defaultZone: http://discovery-service:8761/eureka/
server:
port: 8989
Starting turbine service I have no errors. Docker contained in compose is registered as rabbitmq. card-statement is a service with some #HystrixCommand(fallbackMethod = to be observed on dashboard...
2019-05-14 16:12:57.288 INFO 6 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2019-05-14 16:12:57.373 INFO 6 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'taskScheduler' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.
2019-05-14 16:12:57.441 INFO 6 --- [ main] faultConfiguringBeanFactoryPostProcessor : No bean named 'integrationHeaderChannelRegistry' has been explicitly defined. Therefore, a default DefaultHeaderChannelRegistry will be created.
2019-05-14 16:12:58.494 INFO 6 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.integration.config.IntegrationManagementConfiguration' of type [org.springframework.integration.config.IntegrationManagementConfiguration$$EnhancerBySpringCGLIB$$1a0a1e3f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-14 16:12:58.617 INFO 6 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationJmxConfiguration' of type [org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationJmxConfiguration$$EnhancerBySpringCGLIB$$f59c295f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-14 16:12:58.704 INFO 6 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration' of type [org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration$$EnhancerBySpringCGLIB$$2e83d22c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-14 16:12:58.961 INFO 6 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'mbeanServer' of type [com.sun.jmx.mbeanserver.JmxMBeanServer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-14 16:12:59.122 INFO 6 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'integrationDisposableAutoCreatedBeans' of type [org.springframework.integration.config.annotation.Disposables] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-14 16:12:59.354 INFO 6 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$cb32660d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-05-14 16:13:01.701 WARN 6 --- [ main] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2019-05-14 16:13:01.889 INFO 6 --- [ main] io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2019-05-14 16:13:01.889 INFO 6 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 15942 ms
2019-05-14 16:13:02.653 WARN 6 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-05-14 16:13:02.653 INFO 6 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-05-14 16:13:02.745 INFO 6 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration#70f59913
2019-05-14 16:13:08.116 WARN 6 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-05-14 16:13:08.116 INFO 6 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-05-14 16:13:10.392 INFO 6 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-05-14 16:13:19.434 INFO 6 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-05-14 16:13:20.108 INFO 6 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler'
2019-05-14 16:13:21.732 INFO 6 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel turbineStreamInput
2019-05-14 16:13:22.397 INFO 6 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel errorChannel
2019-05-14 16:13:22.608 INFO 6 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel nullChannel
2019-05-14 16:13:22.824 INFO 6 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler errorLogger
2019-05-14 16:13:23.068 INFO 6 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageHandler hystrixStreamAggregator.sendToSubject.serviceActivator
2019-05-14 16:13:23.234 INFO 6 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {logging-channel-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChannel' channel
2019-05-14 16:13:23.235 INFO 6 --- [ main] o.s.i.channel.PublishSubscribeChannel : Channel 'turbine-1.errorChannel' has 1 subscriber(s).
2019-05-14 16:13:23.235 INFO 6 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started _org.springframework.integration.errorLogger
2019-05-14 16:13:23.236 INFO 6 --- [ main] o.s.i.endpoint.EventDrivenConsumer : Adding {service-activator:hystrixStreamAggregator.sendToSubject.serviceActivator} as a subscriber to the 'turbineStreamInput' channel
2019-05-14 16:13:23.237 INFO 6 --- [ main] o.s.c.s.m.DirectWithAttributesChannel : Channel 'turbine-1.turbineStreamInput' has 1 subscriber(s).
2019-05-14 16:13:23.240 INFO 6 --- [ main] o.s.i.endpoint.EventDrivenConsumer : started hystrixStreamAggregator.sendToSubject.serviceActivator
2019-05-14 16:13:23.342 INFO 6 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-05-14 16:13:23.619 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-05-14 16:13:24.657 INFO 6 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2019-05-14 16:13:24.657 INFO 6 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2019-05-14 16:13:25.453 INFO 6 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2019-05-14 16:13:25.454 INFO 6 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2019-05-14 16:13:26.240 INFO 6 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2019-05-14 16:13:26.352 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2019-05-14 16:13:26.352 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2019-05-14 16:13:26.352 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2019-05-14 16:13:26.352 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2019-05-14 16:13:26.352 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2019-05-14 16:13:26.352 INFO 6 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
It seems some topics was created. Checking rabbit I do not see turbine service connection. Also trying to verify turbine.stream on dashboard I can see that stream is connected to dashboard, but no updates (card-statement service endpoints registered in hystrix was used). And last thing. I expected turbine is connected to RabbitMQ. I have not detected turbine connection to rabbit via admin console.
Issue
Is there any ideas how to fix turbine?
Turbine code:
#SpringBootApplication
#EnableTurbineStream
#EnableEurekaClient
#EnableDiscoveryClient
public class TurbineApplication {
public static void main(String[] args) {
SpringApplication.run(TurbineApplication.class, args);
}
}

Error registering service to eureka server

I am trying to register a client to spring-eureka-server, client deregisters just after registering
eureka-server logs:
2018-05-13 16:02:47.290 INFO 25557 --- [io-9091-exec-10]
c.n.e.registry.AbstractInstanceRegistry : Registered instance
HELLO-CLIENT/192.168.43.96:hello-client:8072 with status UP
(replication=false) 2018-05-13 16:02:47.438 INFO 25557 ---
[nio-9091-exec-3] c.n.e.registry.AbstractInstanceRegistry :
Registered instance HELLO-CLIENT/192.168.43.96:hello-client:8072 with
status DOWN (replication=false) 2018-05-13 16:02:47.457 INFO 25557
--- [nio-9091-exec-2] c.n.e.registry.AbstractInstanceRegistry : Cancelled instance HELLO-CLIENT/192.168.43.96:hello-client:8072
(replication=false) 2018-05-13 16:02:47.950 INFO 25557 ---
[nio-9091-exec-5] c.n.e.registry.AbstractInstanceRegistry :
Registered instance HELLO-CLIENT/192.168.43.96:hello-client:8072 with
status DOWN (replication=true) 2018-05-13 16:02:47.951 INFO 25557 ---
[nio-9091-exec-5] c.n.e.registry.AbstractInstanceRegistry : Cancelled
instance HELLO-CLIENT/192.168.43.96:hello-client:8072
(replication=true) 2018-05-13 16:03:25.747 INFO 25557 ---
[a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running
the evict task with compensationTime 4ms
Eureka-client logs:
2018-05-13 16:02:47.163 INFO 25676 --- [nfoReplicator-0]
com.netflix.discovery.DiscoveryClient :
DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072:
registering service... 2018-05-13 16:02:47.212 INFO 25676 --- [
main] c.a.helloclient.HelloClientApplication : Started
HelloClientApplication in 7.62 seconds (JVM running for 8.573)
2018-05-13 16:02:47.224 INFO 25676 --- [ Thread-5]
s.c.a.AnnotationConfigApplicationContext : Closing
org.springframework.context.annotation.AnnotationConfigApplicationContext#6f7923a5:
startup date [Sun May 13 16:02:42 IST 2018]; parent:
org.springframework.context.annotation.AnnotationConfigApplicationContext#5c30a9b0
2018-05-13 16:02:47.226 INFO 25676 --- [ Thread-5]
o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application
hello-client with eureka with status DOWN 2018-05-13 16:02:47.227
WARN 25676 --- [ Thread-5] com.netflix.discovery.DiscoveryClient
: Saw local status change event StatusChangeEvent
[timestamp=1526207567227, current=DOWN, previous=UP] 2018-05-13
16:02:47.232 INFO 25676 --- [ Thread-5]
o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2018-05-13 16:02:47.235 INFO 25676 --- [ Thread-5]
com.netflix.discovery.DiscoveryClient : Shutting down
DiscoveryClient ... 2018-05-13 16:02:47.292 INFO 25676 ---
[nfoReplicator-0] com.netflix.discovery.DiscoveryClient :
DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072 -
registration status: 204 2018-05-13 16:02:47.423 INFO 25676 ---
[nfoReplicator-0] com.netflix.discovery.DiscoveryClient :
DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072:
registering service... 2018-05-13 16:02:47.440 INFO 25676 ---
[nfoReplicator-0] com.netflix.discovery.DiscoveryClient :
DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072 -
registration status: 204 2018-05-13 16:02:47.442 INFO 25676 --- [
Thread-5] com.netflix.discovery.DiscoveryClient : Unregistering ...
2018-05-13 16:02:47.460 INFO 25676 --- [ Thread-5]
com.netflix.discovery.DiscoveryClient :
DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072 -
deregister status: 200 2018-05-13 16:02:47.494 INFO 25676 --- [
Thread-5] com.netflix.discovery.DiscoveryClient : Completed shut
down of DiscoveryClient 2018-05-13 16:02:47.495 INFO 25676 --- [
Thread-5] o.s.j.e.a.AnnotationMBeanExporter : Unregistering
JMX-exposed beans on shutdown 2018-05-13 16:02:47.498 INFO 25676 ---
[ Thread-5] o.s.j.e.a.AnnotationMBeanExporter :
Unregistering JMX-exposed beans
Please let me know what could be possibly wrong.
Add
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
into Eureka and client app
It really works !!!
Eureka client deregisters when an app has been shutdown.
Check if there is any other reason why the app is stopping leading to eureka-client deregistering.
For my case, the application was shutting down due to spring-boot-starter-web dependency. After resolving this, the application started well.
Looks like a dependency issue.
If the app works fine (the core functionality) without eureka integration, then try changing the eureka-client dependency version.
I would suggest you to check the following:
Check all the port numbers that you are running
Check for any version issues
Add above web dependency in your eureka pom.xml (it worked for me in Maven projects)

JHipster and mongodb : Error creating bean with name 'mongobee'

I am rather new to JHipster and I followed their instructions in order to create a new app.
The app was created, imported into STS as a Maven project and I updated it.
However as soon as I try to start it via the Boot Dashboard I get this output :
2016-12-07 16:43:14.887 INFO 6396 --- [ restartedMain] com.mycompany.myapp.MdcApp : Starting MdcApp on PC981 with PID 6396 (C:\Users\lvuillaume\Desktop\mdc\target\classes started by lvuillaume in C:\Users\lvuillaume\Desktop\mdc)
2016-12-07 16:43:14.890 DEBUG 6396 --- [ restartedMain] com.mycompany.myapp.MdcApp : Running with Spring Boot v1.4.2.RELEASE, Spring v4.3.4.RELEASE
2016-12-07 16:43:14.891 INFO 6396 --- [ restartedMain] com.mycompany.myapp.MdcApp : The following profiles are active: swagger,dev
2016-12-07 16:43:14.972 DEBUG 6396 --- [kground-preinit] org.jboss.logging : Logging Provider: org.jboss.logging.Slf4jLoggerProvider found via system property
2016-12-07 16:43:18.499 DEBUG 6396 --- [ restartedMain] c.m.myapp.config.AsyncConfiguration : Creating Async Task Executor
2016-12-07 16:43:19.041 DEBUG 6396 --- [ restartedMain] c.m.myapp.config.MetricsConfiguration : Registering JVM gauges
2016-12-07 16:43:19.059 DEBUG 6396 --- [ restartedMain] c.m.myapp.config.MetricsConfiguration : Initializing Metrics JMX reporting
2016-12-07 16:43:19.960 WARN 6396 --- [ restartedMain] io.undertow.websockets.jsr : UT026009: XNIO worker was not set on WebSocketDeploymentInfo, the default worker will be used
2016-12-07 16:43:19.961 WARN 6396 --- [ restartedMain] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2016-12-07 16:43:20.436 INFO 6396 --- [ restartedMain] c.mycompany.myapp.config.WebConfigurer : Web application configuration, using profiles: [swagger, dev]
2016-12-07 16:43:20.437 DEBUG 6396 --- [ restartedMain] c.mycompany.myapp.config.WebConfigurer : Initializing Metrics registries
2016-12-07 16:43:20.442 DEBUG 6396 --- [ restartedMain] c.mycompany.myapp.config.WebConfigurer : Registering Metrics Filter
2016-12-07 16:43:20.442 DEBUG 6396 --- [ restartedMain] c.mycompany.myapp.config.WebConfigurer : Registering Metrics Servlet
2016-12-07 16:43:20.445 INFO 6396 --- [ restartedMain] c.mycompany.myapp.config.WebConfigurer : Web application fully configured
2016-12-07 16:43:20.491 INFO 6396 --- [ restartedMain] com.mycompany.myapp.MdcApp : Running with Spring profile(s) : [swagger, dev]
2016-12-07 16:43:20.579 DEBUG 6396 --- [ restartedMain] c.m.myapp.config.CacheConfiguration : No cache
2016-12-07 16:43:24.805 DEBUG 6396 --- [ restartedMain] c.m.m.c.apidoc.SwaggerConfiguration : Starting Swagger
2016-12-07 16:43:24.816 DEBUG 6396 --- [ restartedMain] c.m.m.c.apidoc.SwaggerConfiguration : Started Swagger in 10 ms
2016-12-07 16:43:24.849 DEBUG 6396 --- [ restartedMain] c.m.myapp.config.DatabaseConfiguration : Configuring Mongobee
2016-12-07 16:43:24.854 INFO 6396 --- [ restartedMain] com.github.mongobee.Mongobee : Mongobee has started the data migration sequence..
2016-12-07 16:43:54.876 WARN 6396 --- [ restartedMain] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/mycompany/myapp/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
2016-12-07 16:43:54.883 INFO 6396 --- [ restartedMain] c.m.myapp.config.CacheConfiguration : Closing Cache Manager
2016-12-07 16:43:54.905 ERROR 6396 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongobee' defined in class path resource [com/mycompany/myapp/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at com.mycompany.myapp.MdcApp.main(MdcApp.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]
at com.mongodb.connection.BaseCluster.createTimeoutException(BaseCluster.java:369)
at com.mongodb.connection.BaseCluster.selectServer(BaseCluster.java:101)
at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:75)
at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.<init>(ClusterBinding.java:71)
at com.mongodb.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:63)
at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:210)
at com.mongodb.operation.FindOperation.execute(FindOperation.java:482)
at com.mongodb.operation.FindOperation.execute(FindOperation.java:79)
at com.mongodb.Mongo.execute(Mongo.java:772)
at com.mongodb.Mongo$2.execute(Mongo.java:759)
at com.mongodb.DBCollection.findOne(DBCollection.java:777)
at com.mongodb.DBCollection.findOne(DBCollection.java:747)
at com.mongodb.DBCollection.findOne(DBCollection.java:694)
at com.github.mongobee.dao.ChangeEntryIndexDao.findRequiredChangeAndAuthorIndex(ChangeEntryIndexDao.java:26)
at com.github.mongobee.dao.ChangeEntryDao.ensureChangeLogCollectionIndex(ChangeEntryDao.java:75)
at com.github.mongobee.dao.ChangeEntryDao.connectMongoDb(ChangeEntryDao.java:34)
at com.github.mongobee.Mongobee.execute(Mongobee.java:135)
at com.github.mongobee.Mongobee.afterPropertiesSet(Mongobee.java:117)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579)
... 19 common frames omitted
I tried to create a similar project but without a Mongodb and it worked.
This error means that there was an error connecting to your database, it confirms this in your stacktrace:
Timed out after 30000 ms while waiting for a server
Please double check your database configuration in the application-dev.properties or application-dev.yml file under src/main/resources/config/.
Depending on whether you use YAML or JSON as the property definition file, double check the database configuration:
YAML:
spring:
data:
mongodb:
host: <your_host_address>
port: <your_port>
database: <database_name>
JSON:
spring.data.mongodb.host=<your_host_address>
spring.data.mongodb.port=<your_port>
spring.data.mongodb.database=<database_name>
After creating a new JHipster project with MongoDb I had the same error.
Before running mvnw (on Windows) I forgot to run the MongoDb itself.
So running mongod.exe in the new command prompt, and then running mvnw solved the issue for me.
This was able to solve my problem:
"Answered my own question...removing the #Bean definition from public
Mongobee mongobee(...) in DatabaseConfiguration.java seems to do the
trick. Haven't done any thorough testing, but the apps starts and I
can create new users."
Link: https://github.com/jhipster/generator-jhipster/issues/8665

Resources