[ 
https://issues.apache.org/jira/browse/CAMEL-19825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17761730#comment-17761730
 ] 

Marco Carletti edited comment on CAMEL-19825 at 9/4/23 8:56 AM:
----------------------------------------------------------------

it seems that KubernetesClusterServiceAutoConfiguration configuration is 
executed after CamelAutoConfiguration even if [there is AutoConfigureBefore 
annotation|https://github.com/apache/camel-spring-boot/blob/main/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java#L35]

Maybe for the Autowired CamelContext, but the service is not set as expected, 
even if the bean is in the Spring context


was (Author: JIRAUSER284142):
it seems that KubernetesClusterServiceAutoConfiguration configuration is 
executed after CamelAutoConfiguration even if [there is AutoConfigureBefore 
annotation|https://github.com/apache/camel-spring-boot/blob/main/components-starter/camel-kubernetes-starter/src/main/java/org/apache/camel/component/kubernetes/springboot/cluster/KubernetesClusterServiceAutoConfiguration.java#L35]

> Kubernetes cluster service is produced but absent in camel services
> -------------------------------------------------------------------
>
>                 Key: CAMEL-19825
>                 URL: https://issues.apache.org/jira/browse/CAMEL-19825
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-kubernetes
>    Affects Versions: 4.0.0
>            Reporter: Federico Mariani
>            Priority: Minor
>
> The example 
> [master|https://github.com/apache/camel-spring-boot-examples/tree/main/master]
>  does not work with camel 4 with the openshift profile due to
> {code:java}
> Caused by: java.lang.IllegalStateException: No cluster service found
>       at 
> org.apache.camel.component.master.MasterComponent.lambda$doInit$0(MasterComponent.java:113)
>  ~[camel-master-4.0.0.redhat-00002.jar!/:4.0.0.redhat-00002]
>       at java.base/java.util.Optional.orElseThrow(Optional.java:403) ~[na:na]
>       at 
> org.apache.camel.component.master.MasterComponent.doInit(MasterComponent.java:112)
>  ~[camel-master-4.0.0.redhat-00002.jar!/:4.0.0.redhat-00002]
> {code}
> In particular, I noticed that the bean KubernetesClusterService is produced 
> by Spring boot, but, the [following line of 
> code|https://github.com/apache/camel/blob/main/core/camel-support/src/main/java/org/apache/camel/support/cluster/ClusterServiceHelper.java#L38]
>  returns an empty list and I do not fully understand how these kinds of beans 
> are added to the services in the camel context.
> A workaround exists, the KubernetesClusterService has to be created manually 
> and added to the camelContext like this
> {code:java}
> getContext().addService(new KubernetesClusterService());
> {code}
> but the same code is working in camel 3.x.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to