Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21419

Camel Spring Boot v. 4.8.1: Multiple Task Executor Beans Detected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.8.1
    • 4.8.2, 4.9.0
    • camel-spring-boot
    • None
    • Unknown

    Description

      On upgrading from Camel 4.8.0 to 4.8.1, the app is resulting in application startup failure. The root cause is a conflict between two beans: applicationTaskExecutor and taskScheduler, both of which are being detected by org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpAutoConfiguration.

      Removing the @EnableScheduling fixes is as there will no longer be two Executor Beans. However, this will result in us not being able to use Spring scheduler.

      Below is the Log:

       
      2024-11-05T15:24:21.657+01:00  WARN 89193 — [service-name] [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpAutoConfiguration': Unsatisfied dependency expressed through field 'executor': No qualifying bean of type 'java.util.concurrent.Executor' available: expected single matching bean but found 2: applicationTaskExecutor,taskScheduler
      2024-11-05T15:24:21.659+01:00  INFO 89193 — [service-name] [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
      2024-11-05T15:24:21.669+01:00  INFO 89193 — [service-name] [           main] .s.b.a.l.ConditionEvaluationReportLogger : 
       
      Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
      2024-11-05T15:24:21.675+01:00 ERROR 89193 — [service-name] [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
       
      ***************************
      APPLICATION FAILED TO START
      ***************************
       
      Description:
       
      Field executor in org.apache.camel.component.platform.http.springboot.SpringBootPlatformHttpAutoConfiguration required a single bean, but 2 were found:

      • applicationTaskExecutor: defined by method 'applicationTaskExecutor' in class path resource [org/springframework/boot/autoconfigure/task/TaskExecutorConfigurations$TaskExecutorConfiguration.class]
      • taskScheduler: defined by method 'taskScheduler' in class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingConfigurations$TaskSchedulerConfiguration.class]
         
        This may be due to missing parameter name information
         
        Action:
         
        Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed
         
        Ensure that your compiler is configured to use the '-parameters' flag.
        You may need to update both your build tool settings as well as your IDE.
        (See https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x#parameter-name-retention)
         

      Attachments

        Activity

          People

            Federico Mariani Federico Mariani
            rabitem Felix Huisinga
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: