2011-06-08 79 views
0

我想從https://graph.facebook.com/search?q=foo&type=group中提取JSON數據。我讀了關於使用JSONP with GWT,但它看起來並不像我可以與Facebook一起工作。因此,我正在打電話給GAE,它打開了一個到Facebook的URL連接。用GWT和GAE解析JSON?

try { 
     String url = String.format(SEARCH_URL_FORMAT, URLEncoder.encode(param, CHARSET)); 
     URLConnection urlConn = new URL(url).openConnection(); 
     InputStream response = urlConn.getInputStream(); 

     JsonObject data = JsonObject.parse(new InputStreamReader(response, CHARSET)); 
    } catch (JsonException e) { 
     throw new RuntimeException("Invalid JSON returned by Facebook."); 
    } 

不幸的是,這將導致以下錯誤:

java.lang.NoClassDefFoundError: com/google/gwt/dev/json/JsonException 
    at java.lang.Class.getDeclaredConstructors0(Native Method) 
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) 
    at java.lang.Class.getConstructor0(Class.java:2699) 
    at java.lang.Class.newInstance0(Class.java:326) 
    at java.lang.Class.newInstance(Class.java:308) 
    at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153) 
    at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428) 
    at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339) 
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166) 
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:58) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:94) 
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157) 
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) 
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) 
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) 
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) 
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) 
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:70) 
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:351) 
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) 
    at org.mortbay.jetty.Server.handle(Server.java:326) 
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) 
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938) 
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755) 
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) 
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) 
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) 
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) 

我在做什麼錯在這裏?有一個更好的方法嗎?

回答