-
Notifications
You must be signed in to change notification settings - Fork 38.5k
EntityManagerFactory startup failure in deferred mode is only available on first use #26093
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
Comments
I don't know but given what you've shared and the exception it is also unclear why you think this is a problem in Spring Boot. If you want support, please take the time to share a small sample that reproduces the problem. You can do so by attaching a zip to this issue or share a link to a GitHub repository. |
@snicoll |
Sorry but guessing what the missing pieces are can lead to wasted efforts. I can reproduce the problem and it's yet another instance of a deadlock due to deferred bootstrap. You can workaround the problem for now by adding the following to your project's configuration:
|
So this isn't a deadlock as I suspected initially. If you're not using deferred mode for JPA, the JPA instructor is initialised in the main thread and leads to the following:
It seems that when using deferred mode, the bean creating fails in the background and is not reported to the main thread. @jhoeller, does that ring a bell. It is possible to make this application fail by injecting the
|
@DredderGun this sample app doesn't interact with the That said, there is a case to log this sooner. I am now going to transfer this issue to the Spring Framework issue tracker as there's nothing we can do in Spring Boot about this. Thanks for the report. |
Hello everyone!
Recently I observed a strange behavior while starting a simple project with Spring-boot + Hibernate that confuse me a lot.
I wrote a simple JPA entity and tried to start the project, but no entity wrote to a database. After long time searching why I accidentally had seen that the app after around 1-2 minute of correct working shut down with exit code 0 and the answer of my question appeared in a console: nested exception is org.hibernate.MappingException: Could not instantiate id generator [entity-name=null]
But why the app keeps silent before that moment and doesn`t show me any information about entity creation process? I think this is not trivial and confusing.
My application.properties for reproduction
And a simple JPA entity with error:
Now if you try to start a project then you will not see any error message for almost a one or two minutes and you doesn`t get what the problem. When you fix the error the entity writes to DB without problems
Srping-boot version: v2.3.5.RELEASE
The text was updated successfully, but these errors were encountered: