Getting error when trying to fetch the object in Parse

957 Views Asked by At

I am creating the web application that will communicate with Parse cloud using parse4j in java. I have added all the required jar files. When I try to insert the data into the Parse cloud, it works fine. But when I try to retrieve the object, I am getting below error

Exception in thread "pool-2-thread-1" java.lang.NoSuchMethodError: org.json.JSONObject.keySet()Ljava/util/Set;

Here's my code

ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");  // class inside Parse
query.whereEqualTo("objectId", "JHdJacL68R");  // particular objectId
query.findInBackground(new FindCallback<ParseObject>() {
    @Override
    public void done(List<ParseObject> objectIdList, ParseException e) {        
        if (e == null) {
            System.out.println("Retrieved object for Id. Object is: " + objectIdList.toString());
        }
        else {
            System.out.println("Bloody error: " + e.getMessage());
            e.printStackTrace();
        }           
    }
});

The json.jar file I am using is http://search.maven.org/remotecontent?filepath=org/codeartisans/org.json/20131017/org.json-20131017.jar

I have added this json.jar file also and it has KeySet() method inside it but still it cannot find it. Don't know why. Please someone help.

1

There are 1 best solutions below

1
On

Please check version of your Jar file.

It seems you have old version, after which the new method is added which is expected at run time.