[
https://issues.apache.org/jira/browse/CAMEL-10034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15322235#comment-15322235
]
Nicola Ferraro commented on CAMEL-10034:
----------------------------------------
Great, it works!
> Spring-boot health check causes application startup failure
> -----------------------------------------------------------
>
> Key: CAMEL-10034
> URL: https://issues.apache.org/jira/browse/CAMEL-10034
> Project: Camel
> Issue Type: Bug
> Components: camel-spring-boot
> Affects Versions: 2.18.0
> Reporter: Nicola Ferraro
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 2.18.0
>
>
> After the introducion of the health check in CAMEL-10026, I get the attached
> exception on a sample application that depends on spring-boot-starter and
> camel-spring-boot-starter.
> The problem seems to be related to the following dependency on the
> camel-spring-boot module:
> {noformat}
> <dependency>
> <groupId>org.springframework.boot</groupId>
> <artifactId>spring-boot-actuator</artifactId>
> <optional>true</optional>
> <version>${spring-boot-version}</version>
> </dependency>
> {noformat}
> The dependency is declared as *optional*, but the HealthCheck component
> inherits from org.springframework.boot.actuate.health.AbstractHealthIndicator.
> A project importing the camel-spring-boot module does not import transitively
> the actuator module, so I get the exception.
> If the application does not start, the dependency cannot be *optional*.
> Excaption:
> {noformat}
> java.lang.IllegalStateException: Could not evaluate condition on
> org.apache.camel.spring.boot.health.CamelHealthAutoConfiguration#camelHealthIndicator
> due to org/springframework/boot/actuate/health/AbstractHealthIndicator not
> found. Make sure your own configuration does not rely on that class. This can
> also happen if you are @ComponentScanning a springframework package (e.g. if
> you put a @ComponentScan in the default package by mistake)
> at
> org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55)
> ~[spring-boot-autoconfigure-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:178)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:140)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:333)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:273)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:98)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:678)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:520)
> ~[spring-context-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
> [spring-boot-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
> [spring-boot-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
> [spring-boot-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
> [spring-boot-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
> [spring-boot-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at org.apache.camel.itest.springboot.ITestBoot.main(ITestBoot.java:29)
> [test.jar!/:na]
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[na:1.8.0_91]
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> ~[na:1.8.0_91]
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ~[na:1.8.0_91]
> at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
> at
> org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
> [test.jar!/:na]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
> Caused by: java.lang.NoClassDefFoundError:
> org/springframework/boot/actuate/health/AbstractHealthIndicator
> at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_91]
> at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
> ~[na:1.8.0_91]
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> ~[na:1.8.0_91]
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
> ~[na:1.8.0_91]
> at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> ~[na:1.8.0_91]
> at java.net.URLClassLoader$1.run(URLClassLoader.java:368) ~[na:1.8.0_91]
> at java.net.URLClassLoader$1.run(URLClassLoader.java:362) ~[na:1.8.0_91]
> at java.security.AccessController.doPrivileged(Native Method)
> ~[na:1.8.0_91]
> at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> ~[na:1.8.0_91]
> at
> org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:170)
> ~[test.jar!/:na]
> at
> org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
> ~[test.jar!/:na]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_91]
> at
> org.springframework.core.type.classreading.AnnotationReadingVisitorUtils.convertClassValues(AnnotationReadingVisitorUtils.java:73)
> ~[spring-core-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.core.type.classreading.MethodMetadataReadingVisitor.getAnnotationAttributes(MethodMetadataReadingVisitor.java:125)
> ~[spring-core-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.core.type.classreading.MethodMetadataReadingVisitor.getAnnotationAttributes(MethodMetadataReadingVisitor.java:118)
> ~[spring-core-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.core.type.classreading.MethodMetadataReadingVisitor.getAnnotationAttributes(MethodMetadataReadingVisitor.java:45)
> ~[spring-core-4.2.6.RELEASE.jar!/:4.2.6.RELEASE]
> at
> org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanSearchSpec.<init>(OnBeanCondition.java:274)
> ~[spring-boot-autoconfigure-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:111)
> ~[spring-boot-autoconfigure-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> at
> org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
> ~[spring-boot-autoconfigure-1.3.5.RELEASE.jar!/:1.3.5.RELEASE]
> ... 22 common frames omitted
> Caused by: java.lang.ClassNotFoundException:
> org.springframework.boot.actuate.health.AbstractHealthIndicator
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> ~[na:1.8.0_91]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_91]
> at
> org.springframework.boot.loader.LaunchedURLClassLoader.doLoadClass(LaunchedURLClassLoader.java:178)
> ~[test.jar!/:na]
> at
> org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:142)
> ~[test.jar!/:na]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_91]
> ... 41 common frames omitted
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)