Skip to content

NoSuchMethodError when using spring-boot-starter-test due to transitive dependency on incomplete clean room implementation of org.json:json #9248

@scottishWill

Description

@scottishWill

Hi,

I recently upgraded a large application to "spring boot 1.5.3" and since the upgrade we had a runtime issue with the JSON Lib (org.json) pulled in by "spring-boot 1.5.3 RELEASE". There was no issue with compiling / building but at runtime certain calls to "com.json.JSONObject" threw a error like this:

_org.json.JSONObject.putOnce(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

After spending alot of time debugging the issue was found to be with spring-boot-starter-test pulling in "android-json" (com.vaadin.external.google). This also has a JSONObject with fully qualified name "com.json.JSONObject" but not the same methods. It was this JSON object that was getting used at runtime and was causing the method not found errors.

We got around the problem by exluding "android-json" from "spring-boot-starter-test" but I suggest it should not be included by default so as to avoid this kind of issue for others.

Thanks,
William

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions