Question

I am developing a GWT application to get the query results from the Freebase. Now I am using the following code in my Service Implementation Class.

import com.freebase.api.Freebase;
import com.freebase.json.JSON;
import com.google.tracker.client.FreebaseService;
import com.google.tracker.client.freebaseapi.Freebase;
import com.google.tracker.client.freebasejson.JSON;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class FreebaseServiceImpl extends RemoteServiceServlet implements FreebaseService{

public String getDirectorName() throws IllegalArgumentException{
    Freebase freebase = Freebase.getFreebase();
    String query_str = "{" +
            "'id':   null," +
            "'type': '/film/film'," +
            "'name': 'Blade Runner'," +
            "'directed_by': [{" +
            "'id':   null," +
            "'name': null" +
            "}]" +
            "}​".replace('\'', '"');

    JSON query = new JSON(query_str);
    JSON result = freebase.mqlread(query);
    @SuppressWarnings("unused")
    String director = result.get("result").get("directed_by").get(0).get("name").string();
        return director;
    }
}

I am getting following error on running the application :

500 The call failed on the server; see server log for details.

What could be the possible reasons for these?

Was it helpful?

Solution

That code isn't even going to compile because you've got name conflicts with your imports (duplicate Freebase, JSON). You'll need to fix that before you can even get started.

Google doesn't, as far as I know, have anything that uses the namespace com.google.tracker. If that's your code from this question, you should change the package name to something in a namespace you control.

The client library that you're using uses the deprecated Freebase APIs. Since you're doing new development, you should be using the new APIs.

If you're still having problems after you fix all the basic stuff, update your question or post a new one.

OTHER TIPS

You can use this client library to use the Freebase APIs

http://code.google.com/p/google-api-java-client/

Where did you get the library you are using ?

Documentation on the APIs is available here - note that you need to use the new APIs:

http://wiki.freebase.com/wiki/API

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top