Skip to content
Advertisement

Spring Boot Docker Native image of Spring R2DBC application on Java 16 fails on unsupported methdod

I have a simple application built on top of org.springframework.boot:spring-boot-starter-parent version 2.5.4-SNAPSHOT and some derived dependencies:

  • org.springframework.boot:spring-boot-starter-data-r2dbc
  • org.springframework.boot:spring-boot-starter-webflux
  • org.springframework.boot:spring-boot-starter-actuator
  • io.r2dbc:r2dbc-postgresql

I use org.springframework.experimental:spring-native version 0.10.3 to enable Spring Native and build using the following plugin:

JavaScript
JavaScript

I build the image using ./mvnw.cmd spring-boot:build-image -Pnative-docker -DskipTests, I get assured Java 16 is bootstrapped correctly, and then the image exists (why it is 41 years old, I have no clue).

JavaScript
JavaScript

After the image is created using, I use docker-compose up to start up the database and then the application (this works as I previously built an image normally using Dockerfile and started together) and the following exception is raised and the Spring Boot application won’t start:

JavaScript

I assume R2DBC somehow uses Class#isSealed which is in the enable preview mode in Java 16. How to make it run?

Advertisement

Answer

For this problem, there has been reported a bug #3870 afterwards on the Oracle/Graal project reproducible on GraalVM 21.3.

The issue is waiting for its resolution.

Advertisement