Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG 3.4.0: No bean of type io.micronaut.context.event.ApplicationEventPublisher exists #7144

Closed
codeconsole opened this issue Mar 25, 2022 · 3 comments
Labels
closed: duplicate This issue or pull request already exists info: workaround available A workaround is available for the issue

Comments

@codeconsole
Copy link

codeconsole commented Mar 25, 2022

This is a bug new to v3.4.0 - Perhaps test building a basic empty app before future releases?

v3.3.4 works fine

Expected Behavior

Freshly created basic app can be run via java -jar./build/libs/test-0.1-all.jar

./gradlew run works:
20:06:55.564 [main] INFO io.micronaut.runtime.Micronaut - Startup completed in 285ms. Server Running: http://localhost:8080

java -jar ./build/libs/test-0.1-all.jar does not work

Actual Behaviour

% ./gradlew assemble
% java -jar ./build/libs/test-0.1-all.jar
 __  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_ 
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
  Micronaut (v3.4.0)

20:02:41.144 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
	at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2795)
	at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1654)
	at io.micronaut.context.BeanLocator.getBean(BeanLocator.java:94)
	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.micronaut.runtime.Micronaut.run(Micronaut.java:320)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:306)
	at test.Application.main(Application.java:8)

Steps To Reproduce

% sdk use java 11.0.14-zulu  
% sdk use micronaut 3.4.0
% mn create-app test
% cd test
% ./gradlew assemble
% java -jar ./build/libs/test-0.1-all.jar

Environment Information

macOS Monterey 12.3
MacBook Pro (14-Inch, 2021)
Chip Apple M1 Pro
Memory 16 GB

Example Application

No response

Version

3.4.0

@codeconsole codeconsole changed the title java -jar: Error starting Micronaut server: No bean of type [io.micronaut.context.event.ApplicationEventPublisher<io.micronaut.context.event.StartupEvent>] exists BUG 3.4.0: No bean of type io.micronaut.context.event.ApplicationEventPublisher exists Mar 25, 2022
@graemerocher
Copy link
Contributor

@sdelamo sdelamo added the closed: duplicate This issue or pull request already exists label Mar 25, 2022
@sdelamo
Copy link
Collaborator

sdelamo commented Mar 25, 2022

Workaround:


shadowJar {
    mergeServiceFiles()
}

@sdelamo sdelamo closed this as completed Mar 25, 2022
@sdelamo sdelamo added the info: workaround available A workaround is available for the issue label Mar 25, 2022
@codeconsole
Copy link
Author

Thanks for the fast response and providing a workaround that I can confirm works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: duplicate This issue or pull request already exists info: workaround available A workaround is available for the issue
Projects
None yet
Development

No branches or pull requests

3 participants