mercredi 7 septembre 2022

Issue while updating java project from JDK11 to JDK17

I have a java project using jdk11. I need to migrate the project to java 17 but integration tests have started failing. As soon as I upgraded to JDK17 I started getting below error:

java.lang.reflect.InaccessibleObjectException: Unable to make private sun.reflect.generics.repository.FieldRepository java.lang.reflect.Field.getGenericInfo() accessible: module java.base does not "opens java.lang.reflect" to unnamed module @5702b3b1

I was also getting error for java.util but that is fixed using below command line code.

I have tried adding the command line options as below but the tests are still failing

                <argLine>
                    --illegal-access=permit
                    --add-opens java.base/java.lang=ALL-UNNAMED
                    --add-opens java.base/sun.reflect=ALL-UNNAMED
                    --add-opens java.base/java.util=ALL-UNNAMED
                </argLine>

Any help is appreciated.





Aucun commentaire:

Enregistrer un commentaire