Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Time Error in SchemaJson.toMap() #101

Closed
santpandey opened this issue Aug 28, 2017 · 6 comments
Closed

Run Time Error in SchemaJson.toMap() #101

santpandey opened this issue Aug 28, 2017 · 6 comments

Comments

@santpandey
Copy link

I am using 1.6.0 version of the jar. I have created a sample schema and when I run my JSON against this schema, I get the following Run Time Exception:

Exception in thread "main" java.lang.NoSuchMethodError: org.json.JSONObject.toMap()Ljava/util/Map;
at org.everit.json.schema.loader.SchemaLoader$SchemaLoaderBuilder.schemaJson(SchemaLoader.java:160)

@erosb
Copy link
Contributor

erosb commented Aug 28, 2017

Please check if there is an other dependency in your project which uses an older version of org.json. There was a similar issue recently here: #98

@santpandey
Copy link
Author

It worked. My issue was exactly the same as #98. Thanks

@erosb erosb closed this as completed Aug 28, 2017
@muenchowk24
Copy link

muenchowk24 commented Mar 2, 2018

Similar issue.
Found multiple occurrences of org.json.JSONObject on the class path:

    jar:file:/C:/Users/user/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class
    jar:file:/C:/Users/user/.m2/repository/org/json/json/20180130/json-20180130.jar!/org/json/JSONObject.class

The jar:file:/C:/Users/user/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class comes from Spring Boot 1.5.10. There is no toMap() method.

Solution: spring-projects/spring-boot#9248

@zhongyingxiang
Copy link

@santpandey How do you solve this problem?

@santpandey
Copy link
Author

@zhjobs When I encountered the problem, I made sure that I was using 20170516 of org.json by manually adding it to pom. After this run mvn dependency:tree -Dverbose command and see whether are you getting old jars of org.json or not. If yes, you must exclude them. Let me know if this helps.

@zhongyingxiang
Copy link

@santpandey Brilliant!It did work! Thanks for your answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants