The API package 'channel' or call 'Cre

2019-07-18 13:27发布

I have a simple web application hosted on tomcat-7 with single servlet. The aim of servlet is to create google channel and then request for a token on opened channel for a user. I have following configuration...

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

The source of Gc.java is...

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);
  }
}

But it gives me an following error...

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)

** Am I missing some libraries? If yes then which and where can I found those.** Any help is really appreciated.

1条回答
叛逆
2楼-- · 2019-07-18 14:03

I got it!!! The goal of my application is to create google channels and send messages on these channels.

I was under impression that, google channel API is an independent library and was tried to place relevant .jar in lib of my tomcat application.

But I was wrong. Google channel API libraries only works on Google AppEngine Server. And thus, any application needs to leverage these Google APIs must be hosted on Google AppEngine Server.

I am open to listen from experts, if I am wrong.

查看更多
登录 后发表回答