When running our AOT smoke tests, the test fails with:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Instantiation of supplied bean failed
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1220) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[data-jpa:6.0.9]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1156) ~[data-jpa:6.0.9]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:931) ~[data-jpa:6.0.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608) ~[data-jpa:6.0.9]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:733) ~[data-jpa:3.1.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435) ~[data-jpa:3.1.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311) ~[data-jpa:3.1.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1305) ~[data-jpa:3.1.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1294) ~[data-jpa:3.1.0-SNAPSHOT]
at com.example.data.jpa.DataJpaApplication.main(DataJpaApplication.java:10) ~[data-jpa:na]
Caused by: java.lang.IllegalStateException: No available JtaPlatform candidates amongst [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform, org.hibernate.service.jta.platform.internal.NoJtaPlatform]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.getNoJtaPlatformManager(HibernateJpaConfiguration.java:213) ~[data-jpa:na]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.configureJtaPlatform(HibernateJpaConfiguration.java:150) ~[data-jpa:na]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.customizeVendorProperties(HibernateJpaConfiguration.java:139) ~[data-jpa:na]
at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:132) ~[data-jpa:na]
at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration__BeanDefinitions.lambda$getEntityManagerFactoryInstanceSupplier$3(JpaBaseConfiguration__BeanDefinitions.java:82) ~[na:na]
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[data-jpa:6.0.9]
at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:200) ~[na:na]
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[data-jpa:6.0.9]
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:212) ~[na:na]
at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:200) ~[na:na]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[data-jpa:6.0.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[data-jpa:6.0.9]
... 16 common frames omitted
The hibernate version is org.hibernate.orm:hibernate-core:6.2.2.Final.
It looks like there are hints missing, as we try to detect create objects of the classes in HibernateJpaConfiguration.
Comment From: mhalbritter
We targeted 3.0.x for this one because it only works with Hibernate 6.1 as the reachability metadata contains reflection hints for those classes. As boot is making the reflection calls, the hints for them should be in the boot codebase.