Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Runtime exception when setting @EnableR2dbcAuditing #860

Closed
zhuangzibin opened this issue Jun 24, 2021 · 1 comment · Fixed by #892
Closed

Runtime exception when setting @EnableR2dbcAuditing #860

zhuangzibin opened this issue Jun 24, 2021 · 1 comment · Fixed by #892
Assignees
Labels
type: compatibility Native image compatibility issue
Milestone

Comments

@zhuangzibin
Copy link

zhuangzibin commented Jun 24, 2021

Hi!
When I set the annotation @EnableR2dbcAuditing(WebFlux + R2DBC), I have the following exception at runtime. When the annotation is commented out, I am able to run successfully the docker native container.

Thanks!

JAVA11
GraalVM 21.1.0.

2021-06-24 09:42:15.989  WARN 1 --- [           main] onfigReactiveWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name 'wechatRepository' defined in com.mcmcnet.micro.repository.WechatRepository defined in @EnableR2dbcRepositories declared on MicroOperationApplication: Cannot resolve reference to bean 'r2dbcEntityTemplate' wh
ile setting bean property 'entityOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcEntityTemplate' defined in class path resource [org/springframework/boot/autoc
onfigure/data/r2dbc/R2dbcDataAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.r2dbc.mapping.even
t.ReactiveAuditingEntityCallback': Cannot create inner bean '(inner bean)#336dc1b6' of type [org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean] while setting constructor argument; nested exception is org.springfra
mework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#336dc1b6': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springf
ramework.beans.factory.config.ObjectFactoryCreatingFactoryBean]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean.<init>()

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-24 09:42:16.000 ERROR 1 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Native reflection configuration for org.springframework.beans.factory.config.ObjectFactoryCreatingFactoryBean.<init>() is missing.

Action:

Native configuration for a method accessed reflectively is likely missing.
You can try to configure native hints in order to specify it explicitly.
See https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/#native-hints for more details.
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 24, 2021
@sdeleuze
Copy link
Contributor

sdeleuze commented Jul 5, 2021

Indeed, there is following error with 0.10.2-SNAPSHOT:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-07-05 12:44:38.850 ERROR 29884 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'r2dbcAuditingHandler': Cannot create inner bean '(inner bean)#4d48f820' of type [org.springframework.data.r2dbc.config.PersistentEntitiesFactoryBean] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4d48f820': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:389) ~[na:na]
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:134) ~[na:na]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:693) ~[na:na]
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:198) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1354) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[na:na]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[na:na]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[na:na]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[na:na]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[na:na]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[na:na]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[demo-r2dbc-auditing:2.5.2]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[demo-r2dbc-auditing:2.5.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[demo-r2dbc-auditing:2.5.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[demo-r2dbc-auditing:2.5.2]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[demo-r2dbc-auditing:2.5.2]
	at com.example.demor2dbcauditing.DemoR2dbcAuditingApplication.main(DemoR2dbcAuditingApplication.java:12) ~[demo-r2dbc-auditing:0.0.1-SNAPSHOT]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#4d48f820': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1354) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[na:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[na:na]
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:374) ~[na:na]
	... 20 common frames omitted

@christophstrobl @schauder Could you please have a look?

@sdeleuze sdeleuze added type: compatibility Native image compatibility issue and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 5, 2021
@sdeleuze sdeleuze added this to the 0.10.2 milestone Jul 5, 2021
schauder added a commit that referenced this issue Jul 6, 2021
schauder added a commit that referenced this issue Jul 13, 2021
sdeleuze pushed a commit that referenced this issue Jul 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: compatibility Native image compatibility issue
Development

Successfully merging a pull request may close this issue.

5 participants