Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法使用GWT应用程序访问freebase_Java_Json_Gwt_Freebase_Mql - Fatal编程技术网

Java 无法使用GWT应用程序访问freebase

Java 无法使用GWT应用程序访问freebase,java,json,gwt,freebase,mql,Java,Json,Gwt,Freebase,Mql,我正在开发一个GWT应用程序,以从Freebase获取查询结果。现在,我在我的服务实现类中使用以下代码 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.cl

我正在开发一个GWT应用程序,以从Freebase获取查询结果。现在,我在我的服务实现类中使用以下代码

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;
    }
}
我在运行应用程序时遇到以下错误:

500服务器上的调用失败;有关详细信息,请参阅服务器日志


可能的原因是什么?

您可以使用此客户端库来使用Freebase API

你从哪里得到你正在使用的图书馆的

此处提供了有关API的文档-请注意,您需要使用新的API:


该代码甚至不会编译,因为您的导入与名称冲突(重复的Freebase、JSON)。你需要在开始之前解决这个问题

据我所知,谷歌没有任何名称空间使用com.Google.tracker。如果这是源代码,则应将包名更改为您控制的命名空间中的某个名称

您正在使用的客户端库使用不推荐使用的Freebase API。因为您正在进行新的开发,所以应该使用新的API


如果在修复所有基本问题后仍有问题,请更新问题或发布新问题。

服务器日志中有什么错误?我看不到错误。我只是想知道这个错误的可能原因。你不能粘贴回控制台的内容吗?我的控制台没有任何错误。我在使用Exception对象的getMessage()函数时收到此消息