Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-19135

Multiple beans found: AbstractExternalIdmSourceSyncService.java

    Details

    • Bug Priority:
      Category 1

      Description

      Summary
      When IDMSync is turned on, activiti-app startup fails in some cases.

      Description
      Observed while working on this example - https://github.com/cijujoseph/activiti-examples/tree/master/aps-email-listener-extension. As part of this extension project I have created a email poller. During the initialization of the custom bean named "mailMessageSource" which you can find in https://github.com/cijujoseph/activiti-examples/blob/master/aps-email-listener-extension/src/main/java/com/activiti/extension/bean/APSImapAdapter.java, the app startup fails with the following error. This happens only when the ldap property ldap.synchronization.full.enabled=true

      process_1 | 10:54:55,393 [localhost-startStop-1] ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter -
       process_1 |
       process_1 | ***************************
       process_1 | APPLICATION FAILED TO START
       process_1 | ***************************
       process_1 |
       process_1 | Description:
       process_1 |
       process_1 | Field taskExecutor in com.activiti.api.idm.AbstractExternalIdmSourceSyncService required a single bean, but 2 were found:
       process_1 | - asyncThreadPoolExecutor: defined by method 'getAsyncExecutor' in class path resource [com/activiti/conf/AsyncConfiguration.class]
       process_1 | - taskScheduler: defined by method 'taskScheduler' in class path resource [com/activiti/conf/SchedulingConfiguration.class]
       process_1 |
       process_1 |
       process_1 | Action:
       process_1 |
       process_1 | 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
      
      

      From the error it is clear that there is a duplicate bean issue during the initialization of beans such as idmSyncResource, ldapSyncService etc. However I am surprised to see that it is popping up only when we try to add additional custom beans!

      Suggested Fix
      As a fix I tried adding a Qualifier to AbstractExternalIdmSourceSyncService.java as shown below to make sure that the correct taskExecutor is injected all the time! This fixed the issue and the activiti-app started fine!

      @Autowired(required=false)
      	@Qualifier("taskScheduler")
      	protected TaskExecutor taskExecutor;
      

        Attachments

          Structure

            Activity

              People

              • Assignee:
                djohnson Doug Johnson
                Reporter:
                cjoseph Ciju Joseph
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Structure Helper Panel