Migrating application from java 8 to java 17 and facing issues with couch base documents BigDecimal types (module system java issue) : #1541
Labels
status: feedback-provided
Feedback has been provided
Java 17
Springboot 2.6.10
Spring-data-couchbase 4.3.6
Example :
@document
public class User {
@id
private final String id;
private final BigDecimal amout;
}
Above User domain has a field with BigDecimal as type and gives the below error and fails (when the app comes up) while spring reflection utils is trying to make amount field accessible.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in com.example.demo.repository.UserRepository defined in @EnableReactiveCouchbaseRepositories declared on CouchbaseReactiveRepositoriesRegistrar.EnableReactiveCouchbaseRepositoriesConfiguration: Invocation of init method failed; nested exception is java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.math.BigInteger java.math.BigDecimal.intVal accessible: module java.base does not "opens java.math" to unnamed module @3b084709
Works good with the following vm arguments, “java --add-opens java.base/java.math=ALL-UNNAMED” (https://openjdk.org/jeps/261). But is this a good approach that could be done in prod environments and will this issue be solved/addressed in any future releases ?
If needed, Will be able to share the code to reproduce the issue.
The text was updated successfully, but these errors were encountered: