Turbine AMQP not receiving the hystrix.stream from services - spring-boot

I am trying to implement Turbine AMQP to actually consolidate all the hystrix.stream from multiple services into one and show it in hystrix dashboard.
Hystrix.stream from my service looks fine:-
Sample of what I am seeing in the stream from my client service:- localhost:4444/hystrix.stream
ping:
data: {"type":"HystrixCommand","name":"getUserAssociations","group":"UserAssociationsDAO","currentTime":1462220674908,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0,"requestCount":0,"rollingCountBadRequests":0,"rollingCountCollapsedRequests":0,"rollingCountEmit":0,"rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackEmit":0,"rollingCountFallbackFailure":0,"rollingCountFallbackMissing":0,"rollingCountFallbackRejection":0,"rollingCountFallbackSuccess":0,"rollingCountResponsesFromCache":0,"rollingCountSemaphoreRejected":0,"rollingCountShortCircuited":0,"rollingCountSuccess":0,"rollingCountThreadPoolRejected":0,"rollingCountTimeout":0,"currentConcurrentExecutionCount":0,"rollingMaxConcurrentExecutionCount":0,"latencyExecute_mean":0,"latencyExecute":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"latencyTotal_mean":0,"latencyTotal":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"propertyValue_circuitBreakerRequestVolumeThreshold":20,"propertyValue_circuitBreakerSleepWindowInMilliseconds":5000,"propertyValue_circuitBreakerErrorThresholdPercentage":50,"propertyValue_circuitBreakerForceOpen":false,"propertyValue_circuitBreakerForceClosed":false,"propertyValue_circuitBreakerEnabled":true,"propertyValue_executionIsolationStrategy":"SEMAPHORE","propertyValue_executionIsolationThreadTimeoutInMilliseconds":60000,"propertyValue_executionTimeoutInMilliseconds":60000,"propertyValue_executionIsolationThreadInterruptOnTimeout":true,"propertyValue_executionIsolationThreadPoolKeyOverride":null,"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"propertyValue_requestCacheEnabled":true,"propertyValue_requestLogEnabled":true,"reportingHosts":1,"threadPool":"UserAssociationsDAO"}
data: {"type":"HystrixCommand","name":"getUserAssociation","group":"UserAssociationsDAO","currentTime":1462220674909,"isCircuitBreakerOpen":false,"errorPercentage":0,"errorCount":0,"requestCount":0,"rollingCountBadRequests":0,"rollingCountCollapsedRequests":0,"rollingCountEmit":0,"rollingCountExceptionsThrown":0,"rollingCountFailure":0,"rollingCountFallbackEmit":0,"rollingCountFallbackFailure":0,"rollingCountFallbackMissing":0,"rollingCountFallbackRejection":0,"rollingCountFallbackSuccess":0,"rollingCountResponsesFromCache":0,"rollingCountSemaphoreRejected":0,"rollingCountShortCircuited":0,"rollingCountSuccess":0,"rollingCountThreadPoolRejected":0,"rollingCountTimeout":0,"currentConcurrentExecutionCount":0,"rollingMaxConcurrentExecutionCount":0,"latencyExecute_mean":0,"latencyExecute":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"latencyTotal_mean":0,"latencyTotal":{"0":0,"25":0,"50":0,"75":0,"90":0,"95":0,"99":0,"99.5":0,"100":0},"propertyValue_circuitBreakerRequestVolumeThreshold":20,"propertyValue_circuitBreakerSleepWindowInMilliseconds":5000,"propertyValue_circuitBreakerErrorThresholdPercentage":50,"propertyValue_circuitBreakerForceOpen":false,"propertyValue_circuitBreakerForceClosed":false,"propertyValue_circuitBreakerEnabled":true,"propertyValue_executionIsolationStrategy":"SEMAPHORE","propertyValue_executionIsolationThreadTimeoutInMilliseconds":60000,"propertyValue_executionTimeoutInMilliseconds":60000,"propertyValue_executionIsolationThreadInterruptOnTimeout":true,"propertyValue_executionIsolationThreadPoolKeyOverride":null,"propertyValue_executionIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_fallbackIsolationSemaphoreMaxConcurrentRequests":10,"propertyValue_metricsRollingStatisticalWindowInMilliseconds":10000,"propertyValue_requestCacheEnabled":true,"propertyValue_requestLogEnabled":true,"reportingHosts":1,"threadPool":"UserAssociationsDAO"}
Gradle dependency from client side:-
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.M5"
}
}
dependencies {
compile ("org.springframework.cloud:spring-cloud-starter-hystrix:1.0.6.RELEASE")
compile 'org.springframework.cloud:spring-cloud-netflix-hystrix-stream:1.1.0.M2'
compile ('org.springframework.cloud:spring-cloud-starter-bus-amqp:1.0.6.RELEASE')
compile ("org.springframework.boot:spring-boot-starter-actuator")
compile ("org.springframework.cloud:spring-cloud-starter-eureka")
compile ("org.springframework.cloud:spring-cloud-config-client")
compile ("org.codehaus.sonar-plugins.java:sonar-jacoco-plugin:2.3")
compile ("org.springframework.boot:spring-boot-starter-web")
compile ("org.codehaus.jackson:jackson-mapper-asl:1.9.2")
compile ('com.netflix.hystrix:hystrix-javanica:1.5.2')
compile ("mysql:mysql-connector-java:5.1.34")
compile ("org.springframework:spring-webmvc:4.2.2.RELEASE")
compile ("org.springframework.boot:spring-boot-starter-data-jpa")
providedRuntime ("org.springframework.boot:spring-boot-starter-tomcat")
testCompile ("org.springframework.boot:spring-boot-starter-test")
querydslapt ("org.hibernate:hibernate-jpamodelgen:5.0.5.Final")
compile 'org.springframework.cloud:spring-cloud-starter-sleuth:1.0.0.M1'
compile 'org.springframework.cloud:spring-cloud-sleuth-core:1.0.0.M1'
}
So I do have a Rabbit MQ server runninng and the turbineAMQP project as well.
My turbineAMQP annotated class:-
#SpringBootApplication
#Configuration
#EnableAutoConfiguration
#EnableTurbineAmqp
#EnableDiscoveryClient
public class TurbineApplication {
public static void main(String[] args) {
SpringApplication.run(TurbineApplication.class, args);
}
}
application.yml
info:
component: Turbine
endpoints:
restart:
enabled: true
shutdown:
enabled: true
turbine:
amqp:
port: 8989
management:
port: 8990
spring:
rabbitmq:
host: localhost
port: 5672
username: guest
password: guest
eureka:
client:
serviceUrl:
defaultZone: ${eurekaurl:http://localhost:8761/eureka/}
gradle dependency on Turbine:-
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-starter-parent:Brixton.M5"
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-actuator-docs')
compile('org.springframework.cloud:spring-cloud-starter-config')
compile('org.springframework.cloud:spring-cloud-config-client')
compile('org.springframework.cloud:spring-cloud-starter-turbine-amqp:1.0.6.RELEASE')
compile('org.springframework.cloud:spring-cloud-starter-eureka')
compile('org.springframework.boot:spring-boot-starter-logging')
compile("org.springframework.boot:spring-boot-starter-web")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
when I try to hit http://localhost:8989/turbine.stream it just says ping and this is what i see in the logs when i try to put the turbione.stream though it is not working in hystrix dashboard.
2016-05-02 13:55:05.865 INFO 9028 --- [o-eventloop-3-4] o.s.c.n.t.amqp.TurbineAmqpConfiguration : SSE Request Received
2016-05-02 13:55:05.906 ERROR 9028 --- [o-eventloop-3-3] i.r.netty.server.DefaultErrorHandler : Unexpected error in RxNetty.
java.io.IOException: An established connection was aborted by the software in your host machine
at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[na:1.8.0_66]
at sun.nio.ch.SocketDispatcher.read(Unknown Source) ~[na:1.8.0_66]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source) ~[na:1.8.0_66]
at sun.nio.ch.IOUtil.read(Unknown Source) ~[na:1.8.0_66]
at sun.nio.ch.SocketChannelImpl.read(Unknown Source) ~[na:1.8.0_66]
at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:311) ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:881) ~[netty-buffer-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:241) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:119) ~[netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.27.Final.jar:4.0.27.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-common-4.0.27.Final.jar:4.0.27.Final]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_66]
What is it that I am doing wrong here to get the turbine.stream to work.
my turbine knows about RabbitMQ but the client side service donot. Is there a need for me to tell the service also I know that turbine knows about all the hystrix.stream(s) from eureka so is turbine responsible to queue the hystrix.stream in Rabbit MQ.
Any help is appreciated I have been stuck in this for a while now and there are no good example that help.

Related

Spring Test with #RestClientTest and #FeignAutoConfiguration not working

I have the following configuration:
#SpringBootApplication
#EnableFeignClients
public class Application {
#FeignClient(name = "theclient")
public interface TheClient {
...
theclient:
ribbon:
listOfServers: http://server:8080
And have the following test:
#RunWith(SpringRunner.class)
#RestClientTest(TheClient.class)
#ImportAutoConfiguration(
classes = {
RibbonAutoConfiguration.class,
FeignRibbonClientAutoConfiguration.class,
FeignAutoConfiguration.class
}
)
public class TheClientTest {
...
The error I get is Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: theclient as if the application.yaml was not read. If I add, however, a config.properties file with the theclient.ribbon.listOfServers=http://server:8080, the tests works and passes.
With #TestPropertySource("classpath:application.yaml") I see in the logs propertySourceLocations = '{classpath:application.yaml}' but I will get the same error.
I also tried to disable ribbon, by adding:
spring:
cloud:
loadbalancer:
ribbon:
enable: false
but it won't work.
I appreciate your input and help.

Kubernetes: Tomcat throws Exception when enabling proxy protocol

I am kind of lost right now. I set up a Kubernetes Cluster, deployed a Spring Boot API and a LoadBalancer which worked fine. Now I want to enable proxy protocol on the LoadBalancer to preserve the real clients IP, but once I do this my Spring Boot API always returns with a 400 Bad Request and an IllegalArgumentException is thrown.
Here is the short stack trace (I masked the ip addresses):
2020-09-29 20:05:58.382 INFO 1 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the HTTP protocol [255.255.255.253 255.255.255.254]
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:560) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
I am using the hcloud-cloud-controller-manager from Hetzner.
Here is my LoadBalancer:
apiVersion: v1
kind: Service
metadata:
labels:
service: auth-service
name: auth-service-service
annotations:
load-balancer.hetzner.cloud/name: "lb-backend"
load-balancer.hetzner.cloud/health-check-port: "80"
load-balancer.hetzner.cloud/uses-proxyprotocol: "true"
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
service: auth-service
externalTrafficPolicy: Local
type: LoadBalancer
Here is my Spring Config:
spring:
datasource:
platform: postgres
url: ${DATABASE_CS}
username: ${DATABASE_USERNAME}
password: ${DATABASE_PASSWORD}
driver-class-name: org.postgresql.Driver
flyway:
schemas: authservice
jpa:
show-sql: false
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
jdbc:
lob:
non_contextual_creation: true
hibernate:
ddl-auto: validate
security:
jwt:
secret-key: ${JWT_SECRET_KEY}
expires: ${JWT_EXPIRES:300000}
mail:
from: ${MAIL_FROM}
fromName: ${MAIL_FROM_NAME}
smtp:
host: ${SMTP_HOST}
username: ${SMTP_USERNAME}
password: ${SMTP_PASSWORD}
port: ${SMTP_PORT:25}
mjml:
app-id: ${MJML_APP_ID}
app-secret: ${MJML_SECRET_KEY}
stripe:
keys:
secret: ${STRIPE_SECRET_KEY}
public: ${STRIPE_PUBLIC_KEY}
server:
forward-headers-strategy: native
As you may have noticed I already tried to enable the forward-headers based on this issue.
Thanks for your help!
You enabled the PROXY protocol, which is not HTTP, but a different protocol to tunnel TCP connections to downstream servers, keeping as much information as possible.
https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
I am quite sure you want to disable this
load-balancer.hetzner.cloud/uses-proxyprotocol: "true"
and instead rely on the forward headers to the the remote-address to the correct value for the client.
To be honest I am not aware that tomcat supports the PROXY protocol. (Edit: Currently is does not, see https://bz.apache.org/bugzilla/show_bug.cgi?id=57830)

#EnableBinding(Source.class) throws Failed to bind properties under 'server.error.include-stacktrace' to org.springframework.boot.autoconfigure.web

Spring Cloud Stream and kafka.
This error shows up after I add the following dependencies. ( If I comment out the #EnableBinding(Source.class) everything works. )
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream</artifactId>
</dependency>
When I add the Enable Binding property,
#SpringBootApplication
#EnableBinding(Source.class)
public class CustomersServiceApplication {
public static void main(String[] args) {
SpringApplication.run(CustomersServiceApplication.class, args);
}
}
And these are my properties
spring:
application:
name : customerservice
cloud:
stream:
bindings:
output:
destination: orgChangeTopic
content-type: application/json
kafka:
binder:
zkNodes: localhost
brokers: localhost
logging:
level:
com.netflix: WARN
org.springframework.web: WARN
com.thoughtmechanix: DEBUG
eureka:
instance:
preferIpAddress: true
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: http://localhost:8761/eureka/
server:
port: 7000
This is my full code, however when I run the application now, I am getting an error.
2019-04-08 15:40:33.325 INFO 22917 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-04-08 15:40:33.336 ERROR 22917 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'server.error.include-stacktrace' to org.springframework.boot.autoconfigure.web.ErrorProperties$IncludeStacktrace:
Property: server.error.include-stacktrace
Value: ALWAYS
Origin: "server.error.include-stacktrace" from property source "devtools"
Reason: 0
Action:
Update your application's configuration
After Adding the property to my properties file. I still get the same error
server:
port: 7000
error:
include-stacktrace : ALWAYS
It looks like spring version conflict issue. Two suggestions here:
Create a clean spring cloud stream with Kafka project, to make sure it works well.
Use mvn dependency tree to analysis conflict spring version.

Zuul and Consul integration issue

I have problem setting up Spring Cloud application with Zuul and Consul service discovery. I have Consul server agent installed and running locally:
./src/main/bash/local_run_consul.sh
When I run Spring Boot application with #EnableZuulProxy annotation I get the following error:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.zuul.filters.RouteLocator]: Factory method 'routeLocator' threw exception; nested exception is java.lang.IllegalStateException: Unable to locate service in consul agent: edge-server-8765
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
... 73 more
Sources:
build.gradle
buildscript {
ext {
springBootVersion = '1.2.7.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'war'
apply plugin: 'spring-boot'
war {
baseName = 'edge-server'
version = '0.0.1-SNAPSHOT'
}
mainClassName = 'com.akamai.pulsar.onboarding.edge.app.ZuulApplication'
dependencies {
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: 'spring-boot-starter-tomcat'
}
compile("org.springframework.boot:spring-boot-starter-undertow")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile('org.springframework.cloud:spring-cloud-starter-zuul:1.0.0.RELEASE')
compile('org.springframework.cloud:spring-cloud-starter-consul-all:1.0.0.M3')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
application.yml
info:
component: Zuul Server
endpoints:
restart:
enabled: true
shutdown:
enabled: true
health:
sensitive: false
zuul:
ignoredServices: "*"
routes:
test-api:
path: /test-api/**
server:
port: 8765
logging:
level:
ROOT: INFO
org.springframework.web: INFO
bootstrap.yml
spring:
application:
name: edge-server
cloud:
consul:
host: localhost
port: 8500
config:
enabled: true
ZuulApplication.java
#SpringBootApplication
#EnableDiscoveryClient
#EnableZuulProxy
public class ZuulApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
}
}
Note: When I comment out the #EnableZuulProxy annotation, my service runs without problems and is registered in Consul correctly.
I have no idea what to do. Maybe there is some bad dependency issue?
Thanks in advance.
There is a bug in spring-cloud-consul with ConsulDiscoveryClient.getLocalServiceInstance.
Setting zuul.ignoreLocalService: false will work around it for now.

java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration

I am trying to write a standalone executable jar (fat jar) . I am using spring boot gradle plugin and writing a SpringBoot App to do this.
Here is my Application.java file
#Configuration
#EnableAutoConfiguration
#EnableRabbit
#EntityScan("persistence.domain")
#EnableJpaRepositories("persistence.repository")
#ComponentScan(basePackages = {"common","service"})
public class Application {
public static void main(final String[] args) {
final SpringApplicationBuilder appBuilder = new SpringApplicationBuilder(
Application.class);
appBuilder.profiles("common", "common_db").run(args);
}
#Bean
#Primary
#ConfigurationProperties(prefix = "spring.datasource")
public DataSource primaryDataSource() {
return DataSourceBuilder.create().build();
}
}
I have specified properties in yml files. For ex application-common etc . While running Application.java I am getting error :
[2015-09-24 14:40:22.304] boot - 32791 INFO [main] ---AnnotationConfigEmbeddedWebApplicationContext: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#51a282af: startup date [Thu Sep 24 14:40:22 IST 2015]; root of context hierarchy
[2015-09-24 14:40:23.194] boot - 32791 WARN [main] --- AnnotationConfigEmbeddedWebApplicationContext: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: ; nested exception is java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:392)
at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:165)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:305)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:611)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
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 org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142)
at storm.Application.main(Application.java:28)
Caused by: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:58)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:92)
at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:190)
at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:435)
at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:389)
... 12 more
Caused by: java.lang.NullPointerException
at org.springframework.boot.autoconfigure.condition.OnPropertyCondition.getMatchOutcome(OnPropertyCondition.java:61)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
... 16 more
Here is my build.gradle
def projects= [
":common",
":persistence",
":adapter"
]
buildscript {
repositories {
mavenCentral()
maven { url 'http://repo.spring.io/snapshot' }
maven { url 'http://repo.spring.io/milestone' }
}
dependencies { classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: springBootVersion }
}
apply plugin: 'spring-boot'
apply plugin: 'maven-publish'
apply from: "${rootDir}/deployTasks.gradle"
springBoot {
mainClass = "storm.Application"
}
dependencies {
compile project(':common')
compile project(':adapter')
compile project(':persistence')
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: '1.1.8.RELEASE'
compile group : 'org.springframework.boot',name: 'spring-boot-autoconfigure', version : '1.1.8.RELEASE'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.1.8.RELEASE'
}
Database specification as in application-common_db.yml
database:
host: localhost
port: 3306
schema: subscriptions
username: root
password: root
autoconnect:
maxReconnects: 3
initialTimeout: 2
timeout:
connectTimeout: 0
socketTimeout: 0
failover:
host: localhost
port: 3306
queriesBeforeRetryMaster: 50
secondsBeforeRetryMaster: 30
spring:
datasource:
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://${database.host}:${database.port},${database.failover.host}:${database.failover.port}/${database.schema}?${database.properties}
username: ${database.username}
password: ${database.password}
continueOnError: true
initialize: false
initialSize: 0
timeBetweenEvictionRunsMillis: 5000
minEvictableIdleTimeMillis: 5000
removeAbandonedTimeout: 60
removeAbandoned: true
minIdle: 0
I am not sure how to resolve this error . Can nybody suggest what is going wrong here and why am i getting nullPointerException.
Help is appreciated .
Thanks
This is caused by non-matching Spring Boot dependencies. Check your classpath to find the offending resources. You have explicitly included version 1.1.8.RELEASE, but you have also included 3 other projects. Those likely contain different Spring Boot versions, leading to this error.
I know this is quite an old one, but I faced similar issue and resolved it in a different way. The actuator-autoconfigure pom somehow was invalid and so it was throwing IllegalStateException. I removed the actuator* dependencies from my maven repo and did a Maven update in eclipse, which then downloaded the correct/valid dependencies and resolved my issue.
In my case I had created a SB app from the SB Initializer and had included a fair number of deps in it to other things. I went in and commented out the refs to them in the build.gradle file and so was left with:
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.hsqldb:hsqldb'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
as deps. Then my bare-bones SB app was able to build and get running successfully. As I go to try to do things that may need those commented-out libs I will add them back and see what breaks.
This error is because of multiple projects having the offending resources.
Try out adding the dependencies projects another way around. (like in pom.xml or external dependencies)
I had the same its because of hibernate-core version issue when you remove the version so it resolve the problem you should try it.
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.4.Final</version>
</dependency>
If it's a new project, make sure you remembered to add spring starter web dependency
I had the same its because of version incompatibility check for version or remove version if using spring boot

Resources