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

JtaPlatform native-image regression between 3.0.5 and 3.0.6 #35174

Closed
ch4mpy opened this issue Apr 26, 2023 · 1 comment
Closed

JtaPlatform native-image regression between 3.0.5 and 3.0.6 #35174

ch4mpy opened this issue Apr 26, 2023 · 1 comment
Labels
status: duplicate A duplicate of another issue

Comments

@ch4mpy
Copy link

ch4mpy commented Apr 26, 2023

There is a regression causing No available JtaPlatform candidates between boot 3.0.5 and 3.0.6, probably due to removed native hints. I have two workarounds taken from the this thread:

  • downgrade native-maven-plugin from 0.9.21 to 0.9.20
<plugin>
	<groupId>org.graalvm.buildtools</groupId>
	<artifactId>native-maven-plugin</artifactId>
	<version>0.9.20</version>
</plugin>
  • use an earlier hibernate-core:
<plugin>
	<groupId>org.graalvm.buildtools</groupId>
	<artifactId>native-maven-plugin</artifactId>
	<configuration>
		<metadataRepository>
			<dependencies>
				<dependency>
					<groupId>org.hibernate.orm</groupId>
					<artifactId>hibernate-core</artifactId>
					<metadataVersion>6.1.1.Final</metadataVersion>
				</dependency>
			</dependencies>
		</metadataRepository>
	</configuration>
</plugin>

To reproduce, build a native image of a vanilla Boot project with spring-data-jpa and a repository. The native image builds buts it fails at startup 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) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1158) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[demo.exe:6.0.8]
        at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1132) ~[demo.exe:6.0.8]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:907) ~[demo.exe:6.0.8]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584) ~[demo.exe:6.0.8]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[demo.exe:3.0.6]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) ~[demo.exe:3.0.6]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[demo.exe:3.0.6]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[demo.exe:3.0.6]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1304) ~[demo.exe:3.0.6]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1293) ~[demo.exe:3.0.6]
        at demo.DemoApplication.main(DemoApplication.java:10) ~[demo.exe: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) ~[demo.exe:na]
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.configureJtaPlatform(HibernateJpaConfiguration.java:150) ~[demo.exe:na]
        at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.customizeVendorProperties(HibernateJpaConfiguration.java:139) ~[demo.exe:na]
        at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:132) ~[demo.exe:na]
        at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration__BeanDefinitions.lambda$getEntityManagerFactoryInstanceSupplier$3(JpaBaseConfiguration__BeanDefinitions.java:84) ~[na:na]
        at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:68) ~[demo.exe:6.0.8]
        at org.springframework.util.function.ThrowingBiFunction.apply(ThrowingBiFunction.java:54) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.lambda$get$2(BeanInstanceSupplier.java:204) ~[na:na]
        at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58) ~[demo.exe:6.0.8]
        at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.invokeBeanSupplier(BeanInstanceSupplier.java:216) ~[na:na]
        at org.springframework.beans.factory.aot.BeanInstanceSupplier.get(BeanInstanceSupplier.java:204) ~[na:na]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.obtainInstanceFromSupplier(DefaultListableBeanFactory.java:947) ~[demo.exe:6.0.8]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1214) ~[demo.exe:6.0.8]
        ... 17 common frames omitted
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 26, 2023
@wilkinsona
Copy link
Member

Duplicates #35103.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Apr 26, 2023
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants