我正在开发一个GWT应用程序,以便从Freebase获取查询结果。这是我的EntryPoint类的代码。
package com.google.tracker.client;
import com.freebase.api.Freebase;
import com.freebase.json.JSON;
import com.google.gwt.core.client.EntryPoint;
public class Tracker implements EntryPoint{
public void onModuleLoad() {
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();
}
}我收到以下错误:
[ERROR] Line 10: No source code is available for type com.freebase.api.Freebase; did you forget to inherit a required module?
[ERROR] Line 21: No source code is available for type com.freebase.json.JSON; did you forget to inherit a required module?造成这些问题的可能原因是什么?
发布于 2012-02-16 21:14:51
Freebase的API包不是GWT模块,因此无法转换为Javascript。这就是为什么“没有源代码可用”的原因。您需要从服务器调用Freebase并将结果发送到客户端。
https://stackoverflow.com/questions/9311438
复制相似问题