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

Invocation of init method failed; nested exception is java.lang.StackOverflowError #27

Open
serezakorotaev opened this issue Oct 18, 2023 · 0 comments

Comments

@serezakorotaev
Copy link

serezakorotaev commented Oct 18, 2023

@lecousin Hi! I have application with entities which have OneToOne and ManyToMany relations.
I marked it how into the docs
(For example)

@foreignkey(onForeignDeleted = ForeignKey.OnForeignDeleted.SET_TO_NULL)
private ClientEntity client;

@foreignkey(onForeignDeleted = ForeignKey.OnForeignDeleted.SET_TO_NULL)
private TenantEntity tenant;

@jointable(joinProperty = "imageEntities", columnName = "object_id", tableName = "rel_object_image")
private Set objectEntities = new HashSet<>();
Many to Many relation in other entity
https://github.com/jointable(joinProperty = "objectEntities", columnName = "image_id", tableName = "rel_object_image")
private Set imageEntities = new HashSet<>();

Also i have lazy init methods

and on the main class
@EnableR2dbcRepositories(repositoryFactoryBeanClass = LcR2dbcRepositoryFactoryBean.class, basePackages = "some.package.entity")
and LcReactiveDataRelationalInitializer.init(); in main method.
Also i have lc-reactive-data-relational.yaml file with relation which app scans after starting

and I have error when i start application

2023-10-18T16:56:51.117 [main] INFO  n.l.r.d.relational.enhance.Enhancer.enhanceClasses - Enhancing 5 entity classe(s)
2023-10-18T16:56:51.155 [main] INFO  n.l.r.d.relational.enhance.Enhancer.createJoinTable - Create join table class ru.mts.iot.core.repoimgsrv.entity.JoinEntity_ImageEntity_ObjectEntity with table name rel_object_image
2023-10-18T16:56:51.227 [main] INFO  n.l.r.d.relational.enhance.Enhancer.enhanceClasses - 6 class(es) enhanced

Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'imageRepository' defined in ru.mts.iot.core.repoimgsrv.repository.ImageRepository defined in @EnableR2dbcRepositories declared on R2dbcRepositoriesAutoConfigureRegistrar.EnableR2dbcRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.StackOverflowError
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)

I think cause is with relations. Can you help me please? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant