spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.22k stars 40.7k forks source link

Exception after upgrading to 1.2.0.RELEASE from 1.1.9.RELEASE #2285

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi,

After updating to 1.2.0.RELEASE, my spring boot application got several exceptions.

Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Failed to load bean class: ; nested exception is java.lang.IllegalStateException: Error processing condition on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$SolrHealthIndicatorConfiguration
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:390)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:162)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:299)
    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:609)
    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:321)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.IllegalStateException: Error processing condition on org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration$SolrHealthIndicatorConfiguration
    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:187)
    at org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:294)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:222)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:205)
    at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:433)
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:387)
    ... 16 more
Caused by: java.lang.IllegalStateException: The name or value attribute of @ConditionalOnProperty must be specified
    at org.springframework.util.Assert.state(Assert.java:385)
    at org.springframework.boot.autoconfigure.condition.OnPropertyCondition.getNames(OnPropertyCondition.java:101)
    at org.springframework.boot.autoconfigure.condition.OnPropertyCondition.getMatchOutcome(OnPropertyCondition.java:55)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
    ... 23 more

I have no clue why this happens. Do you have any clue?

It runs fine with 1.1.9.RELEASE version.

Thanks.

philwebb commented 9 years ago

That's a very strange exception. It seems to be saying that the @ConditionalOnProperty annotation on SolrHealthIndicatorConfiguration is incorrect, but looking at the code it seems fine. Do you have an example project that you could share? Can you also check your classpath to make sure that you have any older jars kicking about.

ghost commented 9 years ago

Sorry, I'm not able to share the entire project, but I would be able to share partial part which you want to examine.

I want to know in detail what jars you think related to this issue if it is other than springboot jars.

I checked classpath to confirm any old springboot related jars are loaded. I extracted application jar file and checked lib folder to check all the jar files related to springboot. It seems that all the springboot related jars are 1.2.0.RELEASE, none of them is 1.1.9.RELEASE.

philwebb commented 9 years ago

It was specifically spring boot and spring framework jars that I was interested in. If you are able to share a cut down version of your project that would be great. On Jan 5, 2015 1:34 PM, "Sky Moon" notifications@github.com wrote:

Sorry, I'm not able to share entire project, but I would be able to share partial part you want to examine.

I want to know in detail what jars you think related to this issue if it is other than springboot jars.

I checked classpath to confirm any old springboot related jars are loaded. I extracted application jar file and checked lib folder to check all the jar files related to springboot. It seems that all the springboot related jars are 1.2.0.RELEASE, none of them is 1.1.9.RELEASE.

— Reply to this email directly or view it on GitHub https://github.com/spring-projects/spring-boot/issues/2285#issuecomment-68785777 .

cemo commented 9 years ago

Dependency tree might help as well.

ghost commented 9 years ago

I've seen that you updated OnPropertyCondition.java related to https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnPropertyCondition.java.

Is the change applied to 1.2.0.RELEASE?

BTW, the dependency tree is like below.

+- com.netflix.servo:servo-core:jar:0.7.4:compile
[INFO] |  |  +- com.google.guava:guava:jar:14.0.1:compile
[INFO] |  |  \- com.google.code.findbugs:annotations:jar:2.0.0:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.3:compile
[INFO] |  +- org.apache.camel:camel-core:jar:2.13.0:compile
[INFO] |  +- org.springframework:spring-core:jar:4.0.3.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.0.3.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-aop:jar:4.0.3.RELEASE:compile
[INFO] |  |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:4.0.3.RELEASE:compile
[INFO] |  +- javax.inject:javax.inject:jar:1:compile
[INFO] |  +- org.apache.kafka:kafka_2.10:jar:0.8.1.1:compile
[INFO] |  |  +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] |  |  +- org.xerial.snappy:snappy-java:jar:1.0.5:compile
[INFO] |  |  +- net.sf.jopt-simple:jopt-simple:jar:3.2:compile
[INFO] |  |  \- com.101tec:zkclient:jar:0.3:compile
[INFO] |  +- org.apache.avro:avro:jar:1.7.6:compile
[INFO] |  |  +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] |  |  \- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] |  |     \- org.tukaani:xz:jar:1.0:compile
[INFO] |  +- org.apache.zookeeper:zookeeper:jar:3.3.4:compile
[INFO] |  |  \- jline:jline:jar:0.9.94:compile
[INFO] |  |     \- junit:junit:jar:3.8.1:compile
[INFO] |  +- asm:asm:jar:3.3.1:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] |  +- org.slf4j:jcl-over-slf4j:jar:1.7.7:compile
[INFO] |  +- ch.qos.logback:logback-classic:jar:1.1.2:compile
[INFO] |  |  \- ch.qos.logback:logback-core:jar:1.1.2:compile
[INFO] |  +- org.glassfish.hk2:hk2:jar:2.4.0-b02:compile
[INFO] |  |  +- org.glassfish.hk2:hk2-utils:jar:2.4.0-b02:compile
[INFO] |  |  +- org.glassfish.hk2:hk2-api:jar:2.4.0-b02:compile
[INFO] |  |  |  \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b02:compile
[INFO] |  |  +- org.glassfish.hk2:config-types:jar:2.4.0-b02:compile
[INFO] |  |  +- org.glassfish.hk2:core:jar:2.4.0-b02:compile
[INFO] |  |  +- org.glassfish.hk2:hk2-config:jar:2.4.0-b02:compile
[INFO] |  |  |  +- org.jvnet:tiger-types:jar:1.4:compile
[INFO] |  |  |  \- org.glassfish.hk2.external:bean-validator:jar:2.4.0-b02:compile
[INFO] |  |  +- org.glassfish.hk2:hk2-locator:jar:2.4.0-b02:compile
[INFO] |  |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.4.0-b02:compile
[INFO] |  |  |  \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] |  |  +- org.glassfish.hk2:hk2-runlevel:jar:2.4.0-b02:compile
[INFO] |  |  \- org.glassfish.hk2:class-model:jar:2.4.0-b02:compile
[INFO] |  |     \- org.glassfish.hk2.external:asm-all-repackaged:jar:2.4.0-b02:compile
[INFO] |  +- org.springframework:spring-webmvc:jar:4.0.5.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-expression:jar:4.0.5.RELEASE:compile
[INFO] |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0-m10:compile
[INFO] |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  \- org.jasypt:jasypt:jar:1.9.2:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- org.springframework.boot:spring-boot-actuator:jar:1.2.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:1.2.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.2.0.RELEASE:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.4.4:compile
[INFO] |     \- com.fasterxml.jackson.core:jackson-core:jar:2.4.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:1.2.0.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.2.0.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.2.0.RELEASE:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.7:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.14:runtime
[INFO] |  \- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] |     +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |     +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] |     \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.2.0.RELEASE:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.2.4.v20141103:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.2.4.v20141103:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-util:jar:9.2.4.v20141103:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.2.4.v20141103:compile
[INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.2.4.v20141103:compile
[INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.2.4.v20141103:compile
[INFO] |  +- org.eclipse.jetty:jetty-jsp:jar:9.2.4.v20141103:compile
[INFO] |  |  +- org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0:compile
[INFO] |  |  +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] |  |  +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:compile
[INFO] |  |  +- org.glassfish.web:javax.servlet.jsp:jar:2.3.2:compile
[INFO] |  |  +- org.eclipse.jetty.orbit:javax.servlet.jsp.jstl:jar:1.2.0.v201105211821:compile
[INFO] |  |  +- org.glassfish.web:javax.servlet.jsp.jstl:jar:1.2.2:compile
[INFO] |  |  +- org.glassfish:javax.el:jar:3.0.0:compile
[INFO] |  |  \- org.eclipse.jetty.orbit:org.eclipse.jdt.core:jar:3.8.2.v20130121:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.2.4.v20141103:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.2.4.v20141103:compile
[INFO] |  |  |  +- org.eclipse.jetty.websocket:websocket-api:jar:9.2.4.v20141103:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-io:jar:9.2.4.v20141103:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.2.4.v20141103:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-servlet:jar:9.2.4.v20141103:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-http:jar:9.2.4.v20141103:compile
[INFO] |  \- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.2.4.v20141103:compile
[INFO] |     +- org.eclipse.jetty:jetty-annotations:jar:9.2.4.v20141103:compile
[INFO] |     |  +- org.eclipse.jetty:jetty-plus:jar:9.2.4.v20141103:compile
[INFO] |     |  |  \- org.eclipse.jetty:jetty-jndi:jar:9.2.4.v20141103:compile
[INFO] |     |  +- org.ow2.asm:asm:jar:5.0.1:compile
[INFO] |     |  \- org.ow2.asm:asm-commons:jar:5.0.1:compile
[INFO] |     |     \- org.ow2.asm:asm-tree:jar:5.0.1:compile
[INFO] |     +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.2.4.v20141103:compile
[INFO] |     \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] +- org.testng:testng:jar:6.8.8:test
[INFO] |  +- org.beanshell:bsh:jar:2.0b4:test
[INFO] |  \- com.beust:jcommander:jar:1.27:test
[INFO] +- org.mockito:mockito-all:jar:1.9.5:test
[INFO] +- org.mockito:mockito-core:jar:1.9.5:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] |  \- org.objenesis:objenesis:jar:1.0:test
[INFO] \- org.springframework:spring-test:jar:4.0.3.RELEASE:test
philwebb commented 9 years ago

It looks like you are trying to use Spring Boot 1.2 with Spring Framework 4.0.5. You need to upgrade your Spring Framework dependency. See the release notes for details.

snicoll commented 9 years ago

@mtm0riah one way to avoid this problem is to use Boot's dependency management that will align Spring framework (and tons of other supported open source libraries) automatically. It's very nice and I'd recommend you to give it a try instead of maintaining those relationships yourself. Have a look to the documentation for more details.

ghost commented 9 years ago

Thank @philwebb, it fixed the issue. @snicoll Thank you for the information.