Hi people, I will raise a small issue here, as I was not able to leave a comment at the Spring Boot 3.0 M5 Blog. As we have Spring Native Support for JPA now for a while for 2.x, out of the box.
I can't get it to work with 3.0. Neither with the latest M5 .. nor the latest SNAPSHOT. It will always spit out the error below. Now with RC1 on the horizon in less than two weeks => Is there a possibility for me to solve this ?
Or is 3.0 just not ready for JPA Native ?
Thank you for your time.
--- cut ---
No available JtaPlatform candidates amongst [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform,
Comment From: snicoll
@goafabric a comment on the blog isn't a good way to ask for support. We'd need a small repro that reproduces this as we have several smoke tests around JPA working so we need to know more about your setup to make progress.
Comment From: goafabric
@snicoll ah ok .. so that basically means that it should work with 3.0 ? ok i can take a look if i can downsize the project .. thank you for your reply
Comment From: goafabric
reduced it as much as possible https://github.com/goafabric/person-service/tree/spring-boot-3-jpa-downsized
./native-compile => should compile and startup .. basically its just doing gradlew nativeCompile
the application is now pretty straight forward rest controller + jpa ..
Comment From: bclozel
Sorry but this is far from being minimal. From custom parent to tracing/cloud/mapstruct and more, to docker commands? The app itself also has a dependency on Spring Native - which should not be used with Spring Boot 3.0, as native support is now provided out-of-the-box and the experimental dependency is about to be entirely phased out.
<dependency>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-native</artifactId>
</dependency>
Could you reduce this sample significantly?
Comment From: goafabric
@bclozel please read my comment carefully .. the pom is not used but i can remove that
already found out one part of the problem upgrading 'org.graalvm.buildtools.native' version '0.9.13' => 0.9.14
gets rid of the jta error .. leading to another error " PostgreSQL JDBC driver classes are inaccessible"
but at least the root seems to be gone
Comment From: snicoll
@goafabric going forward, please take the time to build a small sample as requested. If you don't take the time preparing one, we can't justify spending time looking at it.
Comment From: goafabric
Just to wrap things up ... and if someone stumbles upon this issue ... I was able to get the original project working. To be clear, this also includes REST Calls.
First thing was the upgrade of org.graalvm.buildtools.native to 0.9.14 to get rid of the JTA error.
On top of what spring-native 0.12.1 provides, the following things need to be added for 3.0-M5:
- ReflectionHint for SimpleClientHttpRequestFactory
- ReflectionHint for a Class that implements the Hibernate "StatementInspector"
- ClassPathResourceHint for "spring.sql.init.schema-locations: classpath*:db/migration/V1__init.sql"
Comment From: ah1508
Sorry but I have the same problem with Spring Boot 3.0 GA. Simple Java 17 project created with start.spring.io with spring-starter-data-jpa, spring-boot-starter-web and hsqldb dependencies.
The project: demo-spring.zip
mvn clean package -Pnative produces the image without error but when I run the container: No available JtaPlatform candidates amongst [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform, org.hibernate.service.jta.platform.internal.NoJtaPlatform]
Full stacktrace: stacktrace-1.txt. %PARSER_ERROR at the beginning comes from logback.
mvn -Pnative native:compile produces the binary without error. when I launch it: java.lang.NoClassDefFoundError: Could not initialize class org.hsqldb.dbinfo.DatabaseInformationFull. Stacktrace: stacktrace-2.txt
Did I miss something in the documentation ?
Comment From: wilkinsona
HSQLDB does not work in a native image. If you want to use an in-memory database, please use H2. I've added a note about this to our wiki.
Comment From: ah1508
I just tried with H2 with the demo app (com.h2database:h2) but still cannot run the container.
It is another problem. The stacktrace
I also tried with postgresql, same problem.
Comment From: wilkinsona
There appears to be a problem with Hikari but I can't identify the cause from a stack trace alone. It may be logging related given the other%PARSER_ERROR problems in your log. Please open a new issue with a minimal sample that reproduces the problem and we can take a look.