TestProject Forum

Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @4567f35d

Hi,

I am trying to run the ChromeDriver text example provided in GitHub - testproject-io/java-opensdk: TestProject Java OpenSDK and getting the below error when run the code:

Exception in thread “main” java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not “opens java.io” to unnamed module @498d318c
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:178)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:172)
at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible(UnsafeReflectionAccessor.java:44)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:53)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
at com.google.gson.Gson.getAdapter(Gson.java:458)
at com.google.gson.Gson.toJson(Gson.java:696)
at com.google.gson.Gson.toJson(Gson.java:683)
at com.google.gson.Gson.toJson(Gson.java:638)
at com.google.gson.Gson.toJson(Gson.java:618)
at io.testproject.sdk.internal.rest.AgentClient.startSession(AgentClient.java:656)
at io.testproject.sdk.internal.rest.AgentClient.(AgentClient.java:275)
at io.testproject.sdk.internal.rest.AgentClient.getClient(AgentClient.java:547)
at io.testproject.sdk.drivers.web.ChromeDriver.(ChromeDriver.java:757)
at io.testproject.sdk.drivers.web.ChromeDriver.(ChromeDriver.java:722)
at io.testproject.sdk.drivers.web.ChromeDriver.(ChromeDriver.java:622)
at io.testproject.sdk.drivers.web.ChromeDriver.(ChromeDriver.java:119)
at io.testproject.WebTest.main(WebTest.java:10)

OS: Windows 10
Java SDK17(LTS)
API Key configured and ENV variable.

Please assist.

Hi @RafiMirel . OpenSDK doesn’t support JDK 17 at this time.
You can try using JDK 11 (the officially supported version) and it should solve your problem

Thanks.
I will try.

Suggest to update the below part in the instructions:
*“You must have Java Development Kit (JDK) 11 or newer installed.”

Issue resolved after downgrade to JDK 11.
Thanks.