Skip to content

EventListener in DelegatingEventExternalizer could not be created - Similar To Issue 973 #1170

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

Open
ashwinibuche opened this issue Apr 22, 2025 · 7 comments
Assignees
Labels
meta: waiting for feedback Waiting for feedback of the original reporter

Comments

@ashwinibuche
Copy link

ashwinibuche commented Apr 22, 2025

When using Spring Modulith 1.3.3 (starter + events-core + NATS Event) with Spring Boot 3.4.3, the auto-configured DelegatingEventExternalizer instance 'natsEventExternalizer' , continuously receiving EventListenerMethodProcessor can not find the @ApplicationModuleListener annotated method on, resulting in the following stacktrace:

org.springframework.beans.factory.BeanInitializationException: Failed to process @EventListener annotation on bean with name 'natsEventExternalizer': Need to invoke method 'externalize' declared on target class 'DelegatingEventExternalizer', but not found in any interface(s) of the exposed proxy type. Either pull the method up to an interface or switch to CGLIB proxies by enforcing proxy-target-class mode in your configuration.
	at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:149) ~[spring-context-6.2.3.jar:6.2.3]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1083) ~[spring-beans-6.2.3.jar:6.2.3]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:987) ~[spring-context-6.2.3.jar:6.2.3]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627) ~[spring-context-6.2.3.jar:6.2.3]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.4.3.jar:3.4.3]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) ~[spring-boot-3.4.3.jar:3.4.3]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[spring-boot-3.4.3.jar:3.4.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) ~[spring-boot-3.4.3.jar:3.4.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361) ~[spring-boot-3.4.3.jar:3.4.3]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350) ~[spring-boot-3.4.3.jar:3.4.3]
	at org.rockwell.publishermodulith.main(publishermodulith.java:14) ~[classes/:na]
Caused by: java.lang.IllegalStateException: Need to invoke method 'externalize' declared on target class 'DelegatingEventExternalizer', but not found in any interface(s) of the exposed proxy type. Either pull the method up to an interface or switch to CGLIB proxies by enforcing proxy-target-class mode in your configuration.
	at org.springframework.core.MethodIntrospector.selectInvocableMethod(MethodIntrospector.java:135) ~[spring-core-6.2.3.jar:6.2.3]
	at org.springframework.aop.support.AopUtils.selectInvocableMethod(AopUtils.java:150) ~[spring-aop-6.2.3.jar:6.2.3]
	at org.springframework.context.event.EventListenerMethodProcessor.processBean(EventListenerMethodProcessor.java:189) ~[spring-context-6.2.3.jar:6.2.3]
	at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:145) ~[spring-context-6.2.3.jar:6.2.3]
	... 10 common frames omitted

Process finished with exit code 1

@ashwinibuche
Copy link
Author

I am attaching the project workspace in this issue which is maven based

@ashwinibuche
Copy link
Author

@ashwinibuche
Copy link
Author

both the zip files are the same

@odrotbohm
Copy link
Member

I can't start any of the projects contained in the zip. Please reduce the content of the ZIP as much as possible. And make sure that any simple Maven command (mvn clean verify or mvn spring-boot:run) reproduces the error.

The exception looks like something is enabling JDK proxying of the ElegatingEventExternalizer bean, and I am unsure what that is.

@odrotbohm odrotbohm self-assigned this Apr 24, 2025
@odrotbohm odrotbohm added the meta: waiting for feedback Waiting for feedback of the original reporter label Apr 24, 2025
@ashwinibuche
Copy link
Author

ashwinibuche commented Apr 25, 2025

@odrotbohm thanks for your revert.

mvn spring-boot:run does reproduce the error. Please find the attached snapshot of the powershell. I have reduced the file size now. Hope you would be able to extract the file at your end

Image

@ashwinibuche
Copy link
Author

I am attaching my workspace over here

ModulithExternalization.zip

@porlikowski
Copy link

porlikowski commented Apr 30, 2025

I had the same issue as You mentioned. Try to add

 <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

to Your dependencies it works for me. But i didn't find solution. @odrotbohm maybe it will help You with debugging.
As far as i've checked it it is connected with database transacion and outbox pattern in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta: waiting for feedback Waiting for feedback of the original reporter
Projects
None yet
Development

No branches or pull requests

3 participants