Recebendo erro do servidor, adicionei a biblioteca gson-2.8.2.jar, quando utilizo o exemplo para converter a um objeto em json recebo o erro.
Type Exception Report
Message access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")
java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:485)
java.base/java.security.AccessController.checkPermission(AccessController.java:1068)
java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411)
java.base/java.lang.Class.checkMemberAccess(Class.java:3107)
java.base/java.lang.Class.getDeclaredConstructor(Class.java:2806)
com.google.gson.internal.ConstructorConstructor.newDefaultConstructor(ConstructorConstructor.java:99)
com.google.gson.internal.ConstructorConstructor.get(ConstructorConstructor.java:83)
com.google.gson.internal.bind.CollectionTypeAdapterFactory.create(CollectionTypeAdapterFactory.java:54)
com.google.gson.Gson.getAdapter(Gson.java:423) ...