Gradlew run Error: Multiple possible bean candidates found

I’ve been trying to troubleshoot this issue on my MacBook Pro with Monterey Version 12.3.1(21E258). From my command prompt I’m running ./gradlew run and getting the error:

./gradlew run
Starting a Gradle Daemon (subsequent builds will be faster)

> Task :run
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/<redacted>/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.10/f69d97ef3335c6ab82fc21dfb77ac613f90c1221/logback-classic-1.2.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/<redacted>/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.29/82ae07f95088577987a15d90171de12b00d81847/slf4j-simple-1.7.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
 __  __ _                                  _
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
  Micronaut (v3.3.4)

09:54:16.343 [main] INFO  i.m.context.env.DefaultEnvironment - Established active environments: [dev]
09:54:16.641 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Error instantiating bean of type [io.funraise.services.Worker$ApplicationEventListener$onStartup1$Intercepted]: Multiple possible bean candidates found: [io.micronaut.aop.InterceptorRegistry, io.micronaut.aop.InterceptorRegistry]
io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [io.funraise.services.Worker$ApplicationEventListener$onStartup1$Intercepted]: Multiple possible bean candidates found: [io.micronaut.aop.InterceptorRegistry, io.micronaut.aop.InterceptorRegistry]
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2365)
        at io.micronaut.context.DefaultBeanContext.addCandidateToList(DefaultBeanContext.java:3685)
        at io.micronaut.context.DefaultBeanContext.getBeanRegistrations(DefaultBeanContext.java:3567)
        at io.micronaut.context.DefaultBeanContext.getBeansOfType(DefaultBeanContext.java:920)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.lambda$$0(ApplicationEventPublisherFactory.java:217)
        at io.micronaut.core.util.SupplierUtil$2.initialize(SupplierUtil.java:77)
        at io.micronaut.core.util.SupplierUtil$2.get(SupplierUtil.java:72)
        at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:229)
        at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1733)
        at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:344)
        at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:183)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:72)
        at io.funraise.Application.main(Application.java:13)
Caused by: io.micronaut.context.exceptions.NonUniqueBeanException: Multiple possible bean candidates found: [io.micronaut.aop.InterceptorRegistry, io.micronaut.aop.InterceptorRegistry]
        at io.micronaut.context.DefaultBeanContext.findConcreteCandidate(DefaultBeanContext.java:2429)
        at io.micronaut.context.DefaultApplicationContext.findConcreteCandidate(DefaultApplicationContext.java:455)
        at io.micronaut.context.DefaultBeanContext.lastChanceResolve(DefaultBeanContext.java:3253)
        at io.micronaut.context.DefaultBeanContext.findConcreteCandidateNoCache(DefaultBeanContext.java:3140)
        at io.micronaut.context.DefaultBeanContext.findConcreteCandidate(DefaultBeanContext.java:3054)
        at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2750)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:888)
        at io.micronaut.aop.chain.InterceptorChain.resolveInterceptors(InterceptorChain.java:205)
        at io.micronaut.aop.chain.InterceptorChain.resolveIntroductionInterceptors(InterceptorChain.java:144)
        at io.funraise.services.Worker$ApplicationEventListener$onStartup1$Intercepted.<init>(Unknown Source)
        at io.funraise.services.$Worker$ApplicationEventListener$onStartup1$Intercepted$Definition.build(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2336)
        ... 12 common frames omitted

> Task :run FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/Users/<redacted>/.asdf/installs/java/adoptopenjdk-11.0.10+9/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

I’ve removed my user folder name from the above error message.

I’ve run this command previously but now it’s throwing an error. I’m not sure what changed.
Here’s some information concerning my java version

java --version
openjdk 11.0.10 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
javac --version
javac 11.0.10

The exact same code and setup works on a linux box but not the Mac. I’ve tried uninstalling and re-installing java. I’ve tried to clean and then run. I’ve tried ./gradlew --no-build-cache run and ./gradlew build --refresh-dependencies.
Any more ideas on how to troubleshoot this?

Ask the Micronaut community?

aw, my bad. I don’t know why I was thinking it was gradle related. I’ve been just so frustrated with this issue. Thanks for pointing out the obvious when I didn’t notice it.

If anyone is searching here for the solution. You can follow things on the Micronaut discussion: Error: Multiple possible bean candidates found · Discussion #7249 · micronaut-projects/micronaut-core · GitHub