找不到API包'channel'或调用'CreateChannel()'

时间:2012-12-11 04:29:22

标签: google-app-engine tomcat7

我有一个托管在tomcat-7上的简单Web应用程序,带有单个servlet。 servlet的目的是创建谷歌频道,然后在打开的频道上为用户请求令牌。我有以下配置...

WEB-INF
  -- lib
    -- appengine-api-1.0-sdk-1.4.3.jar
  -- classes
    -- Gc.class

Gc.java的来源是......

import com.google.appengine.api.channel.*;
public class Gc extends HttpServlet {
  protected void doGetPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.getWriter().write("Creating channel...<br>");
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    response.getWriter().write("Channel created!<br>");
    response.getWriter().write("Getting token for user 'user1'...<br>");
    String token = channelService.createChannel("user1");
    response.getWriter().write("toekn => "+token);
  }
}

但它给了我一个跟随错误...

type Exception report

*message* **The API package 'channel' or call 'CreateChannel()' was not found.**

*description* **The server encountered an internal error (The API package 'channel' or call 'CreateChannel()' was not found.) that prevented it from fulfilling this request.**

exception

com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'channel' or call 'CreateChannel()' was not found.
    com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:98)
    com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:50)
    com.google.appengine.api.channel.ChannelServiceImpl.createChannel(ChannelServiceImpl.java:40)
    webRtc.Gc.doGetOrPost(Gc.java:46)
    webRtc.Gc.doGet(Gc.java:31)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

**我错过了一些图书馆吗?如果是,那么我可以在哪里找到它们。** 任何帮助都非常感谢。

1 个答案:

答案 0 :(得分:1)

我明白了! 我的应用程序的目标是创建谷歌频道并在这些频道上发送消息。

我的印象是,谷歌频道API是一个独立的库,并试图将相关的.jar放在我的tomcat应用程序的lib中。

但我错了。 Google频道API库仅适用于Google AppEngine Server。因此,任何需要利用这些Google API的应用程序都必须托管在Google AppEngine Server上。

如果我错了,我愿意倾听专家的意见。