Create spring cloud config server project through start.spring.io.
pom.xml is as below
<groupId>com.example.config</groupId>
<artifactId>configServer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>configServer</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Dalston.RELEASE</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
package com.example.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableConfigServer
@EnableEurekaClient
public class ConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigServerApplication.class, args);
}
}
info:
build:
artifact: @project.artifactId@
name: @project.name@
description: @project.description@
version: @project.version@
server:
port: ${port:8886}
spring:
application:
name: configserver
cloud:
config:
server:
git:
uri: http://gitlab.xxxxxxx.corp/ledger/ledger.git
searchPaths: creditcore-ledger
username: xxxxxxxxxx
password: xxxxxxxxxx
rabbitmq:
host: 10.143.128.111
port: 5672
username: test
password: test
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
register-with-eureka: true
fetch-registry: true
instance:
lease-renewal-interval-in-seconds: 5
lease-expiration-duration-in-seconds: 13
prefer-ip-address: true
management:
security:
enabled: false
endpoints:
health:
enabled: true
2017-05-05 15:31:44.479 INFO 9660 --- [ main] c.e.config.ConfigServerApplication : No active profile set, falling back to default profiles: default
2017-05-05 15:31:44.479 INFO 9660 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@32a074ed: startup date [Fri May 05 15:31:44 CST 2017]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@290aeb20
2017-05-05 15:31:44.510 INFO 9660 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2017-05-05 15:31:44.526 WARN 9660 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'binderHealthIndicator' defined in org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration: Unsatisfied dependency expressed through method 'binderHealthIndicator' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2017-05-05 15:31:44.526 INFO 9660 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-05 15:31:44.526 ERROR 9660 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Parameter 0 of method binderHealthIndicator in org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration required a bean of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' in your configuration.
2017-05-05 15:31:44.526 WARN 9660 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'outputBindingLifecycle'; nested exception is java.lang.IllegalStateException: Cannot perform binding, no proper implementation found
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler'
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Unregistering JMX-exposed beans
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: nullChannel
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: errorChannel
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: springCloudBusOutput
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: springCloudBusInput
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Summary on shutdown: _org.springframework.integration.errorLogger.handler
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-05-05 15:31:44.526 INFO 9660 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2017-05-05 15:31:44.573 INFO 9660 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-05 15:31:44.713 ERROR 9660 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Parameter 0 of method binderHealthIndicator in org.springframework.cloud.stream.binder.rabbit.config.RabbitServiceAutoConfiguration$RabbitHealthIndicatorConfiguration required a bean of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.amqp.rabbit.core.RabbitTemplate' in your configuration.
What's wrong??????
Instead of providing poorly formatted code in the issue, please provide a complete project that reproduces the issue either as a git repo or attached as a zip. I tried reproducing the problem with your exact dependencies but can't.
Hi Team,
I have also stumbled upon the same issue mentioned here.
Each case has the code reference from GIT.
Please run the example and launch : http://localhost:8080/reservation-service/master for each demo.
Case 1: Running the latest version and dependencies from start.spring.io
https://github.com/newnav15/config-demos/tree/master/demo1
1) You can go to http://start.spring.io/
2) Add dependency for Config Server and cloud bus amqp
3) For the latest spring-boot-starter-parent version of 1.5.3.RELEASE, there is a problem when used with the latest Dalston.SR1 version of the spring-cloud-dependencies.
4) After setting the GIT URI start the config service, The config server starts, however there is no errors and neither do the requests coming in.The server does not seem to get the requests.
_Any help to get this demo1 code to work is appreciated with the latest Spring Version, latest Dalstun version along with the spring cloud bus._
Case 2: Downgrade Spring version and Dalston without spring cloud dep
https://github.com/newnav15/config-demos/tree/master/demo2
Now,
Downgrading the spring version to 1.5.1.RELEASE , removing the cloud bus dependency and using Dalston.BUILD-SNAPSHOT restores the config service functionally. However unable to use the spring cloud bus
Case 3: Downgrade Spring version , add latest cloud bus
https://github.com/newnav15/config-demos/tree/master/demo3
If I have the spring version as 1.5.1.RELEASE and add the cloud bus dependency which expects the latest Dalston.SR1 version of the spring-cloud-dependencies gives the below error:
java.lang.NoClassDefFoundError: org/springframework/integration/channel/PublishSubscribeChannel
Looks like the new milestone build is having a dependency problem.
Any help is much appreciated.
Uploaded the code for each case here: https://github.com/newnav15/config-demos/
Thanks,
Naveen
Again providing a sample app that reproduces the issue is best.
The server times out on all requests.
The server times out? You mean the server times out when making the request to the Git server?
Have created examples for each of the cases and added to GIT repo to the original comment. Please do review and revert.
Thanks for helping us out.
I don't have problems with your demo1.
Accessing http://localhost:8888/reservation-service/default returns
{
"name": "reservation-service",
"profiles": [
"default"
],
"label": null,
"version": null,
"state": null,
"propertySources": [
{
"name": "https://github.com/newnav15/conf_test/reservation-service.properties",
"source": {
"server.port": "8080",
"spring.cloud.stream.bindings.input.group": "reservations-group",
"spring.cloud.stream.bindings.input.destination": "reservations",
"message": "Hello World with new actuator end point!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
"spring.cloud.stream.bindings.input.durableSubscription": "true"
}
}
]
}
Hi Spencer,
Thank you for taking time out and helping.
After your note, I gave this a shot on another dev sandbox and I can confirm it worked there.
Will look at the environment issue - these are the aspects varying between my machine and the working dev sandbox:
1) The JDK which is the JCE on my machine:
java version "1.8.0_121" or latest
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" from Oracle
2) Firewall policies
Thanks,
Naveen