Skip to content

java.lang.NoClassDefFoundError: com/google/gson/internal/reflect/ReflectionAccessor #253

@NickKanellos

Description

@NickKanellos

Describe the bug

java.lang.NoClassDefFoundError: com/google/gson/internal/reflect/ReflectionAccessor
 at com.ibm.cloud.sdk.core.util.DynamicModelTypeAdapterFactory.(DynamicModelTypeAdapterFactory.java:77)
 at com.ibm.cloud.sdk.core.util.GsonSingleton.registerTypeAdapters(GsonSingleton.java:77)
 at com.ibm.cloud.sdk.core.util.GsonSingleton.createGson(GsonSingleton.java:53)
 at com.ibm.cloud.sdk.core.util.GsonSingleton.getGsonWithoutPrettyPrinting(GsonSingleton.java:102)
 at com.ibm.cloud.sdk.core.http.RequestBuilder.bodyContent(RequestBuilder.java:417)
 at com.ibm.cloud.cloudant.v1.Cloudant.postDocument(Cloudant.java:825)

To Reproduce
call com.ibm.cloud.cloudant.v1.Cloudant.postDocument() using

<dependency>
     <groupId>com.ibm.cloud</groupId>
     <artifactId>cloudant</artifactId>
     <version>0.0.36</version>
</dependency>

and

<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.9.0</version>
</dependency>

Unfortunately I can't use an earlier version of GSON because of this:
google/gson#1875
and this
google/gson#1902

Must gather (please complete the following information):

$ java --version
openjdk 16.0.2 2021-07-20
OpenJDK Runtime Environment Temurin-16.0.2+7 (build 16.0.2+7)
OpenJDK 64-Bit Server VM Temurin-16.0.2+7 (build 16.0.2+7, mixed mode, sharing)

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions