You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As seen in https://guides.micronaut.io/latest/micronaut-graalvm-reflection-gradle-java.html, one can configure graalvm reflection through a reflect-config.json file or with a java file. The latter has the small advantage of giving some IDE help on typing the classes. Other than that, I would expect the two formats below to be strictly equivalent:
For methods that take no parameters or that take a class as a parameter, the two forms are strictly equivalent, and my binary runs just fine. However, for a method that takes a boolean as a parameter, it seems the reflection is not registered with Graalvm when using a Java-based configuration, and I receive the error below. When using a JSON config, everything works just fine.
[main] io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [javax.sql.DataSource] could not be loaded: The program tried to reflectively invoke method public void org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension.setTransactionalLock(boolean) without it being registered for runtime reflection. Add public void org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension.setTransactionalLock(boolean) to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
> [svcs-tracker-dpl-bb6d966bc-nl6gc svcs-tracker-cnt] io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [javax.sql.DataSource] could not be loaded: The program tried to reflectively invoke method public void org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension.setTransactionalLock(boolean) without it being registered for runtime reflection. Add public void org.flywaydb.database.postgresql.PostgreSQLConfigurationExtension.setTransactionalLock(boolean) to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
Steps To Reproduce
In a micronaut project that uses reflection on initialization:
./gradlew --no-configuration-cache nativeRun
Environment Information
$ systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List
OS Name : Microsoft Windows 11 Pro
OS Version : 10.0.22631 N/A Build 22631
OS Manufacturer : Microsoft Corporation
OS Configuration : Standalone Workstation
OS Build Type : Multiprocessor Free
System Boot Time : 15/03/2024, 02:48:47
System Manufacturer : CORSAIR
System Model : CORSAIR VENGEANCE i8100
System Type : x64-based PC
System Directory : C:\Windows\system32
System Locale : en-us;English (United States)
Hotfix(s) : 7 Hotfix(s) Installed.,[01]: KB5034467,[02]: KB5012170,[03]: KB5026039,[04]: KB5027397,[05]: KB5035942,[06]: KB5035967,[07]: KB5036398
$ java -version:
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)
Example Application
No response
Version
4.3.7
The text was updated successfully, but these errors were encountered:
Expected Behavior
As seen in https://guides.micronaut.io/latest/micronaut-graalvm-reflection-gradle-java.html, one can configure graalvm reflection through a reflect-config.json file or with a java file. The latter has the small advantage of giving some IDE help on typing the classes. Other than that, I would expect the two formats below to be strictly equivalent:
The json:
The java:
Actual Behaviour
For methods that take no parameters or that take a class as a parameter, the two forms are strictly equivalent, and my binary runs just fine. However, for a method that takes a boolean as a parameter, it seems the reflection is not registered with Graalvm when using a Java-based configuration, and I receive the error below. When using a JSON config, everything works just fine.
Steps To Reproduce
Environment Information
$ systeminfo /fo csv | ConvertFrom-Csv | select OS*, System*, Hotfix* | Format-List
OS Name : Microsoft Windows 11 Pro
OS Version : 10.0.22631 N/A Build 22631
OS Manufacturer : Microsoft Corporation
OS Configuration : Standalone Workstation
OS Build Type : Multiprocessor Free
System Boot Time : 15/03/2024, 02:48:47
System Manufacturer : CORSAIR
System Model : CORSAIR VENGEANCE i8100
System Type : x64-based PC
System Directory : C:\Windows\system32
System Locale : en-us;English (United States)
Hotfix(s) : 7 Hotfix(s) Installed.,[01]: KB5034467,[02]: KB5012170,[03]: KB5026039,[04]: KB5027397,[05]: KB5035942,[06]: KB5035967,[07]: KB5036398
$ java -version:
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19, mixed mode, sharing)
Example Application
No response
Version
4.3.7
The text was updated successfully, but these errors were encountered: