0
我遇到了這種情況,在我的Mac上本地運行SDK。我正在嘗試建立存在處理。我創建了一個簡單的servlet,除了日誌以外什麼也不做。但是,我得到的任何連接和斷開事件以下例外(雖然渠道似乎另有工作)...Google App Engine頻道呈現處理程序拋出異常
Mar 14, 2013 8:04:25 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /_ah/channel/disconnected/: javax.servlet.UnavailableException: java.lang.InstantiationException
Mar 14, 2013 8:04:38 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: /_ah/channel/connected/: javax.servlet.UnavailableException: java.lang.InstantiationException
我已經註冊了的servlet的渠道在我的網站都連接和斷開.XML ...
<servlet>
<servlet-name>ChannelPresence</servlet-name>
<servlet-class>com.readyposition.gaetestbed.ChannelPresenceServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ChannelPresence</servlet-name>
<url-pattern>/_ah/channel/connected/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ChannelPresence</servlet-name>
<url-pattern>/_ah/channel/disconnected/</url-pattern>
</servlet-mapping>
處理程序(servlet的)本身是很基本的...
package com.readyposition.gaetestbed;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.appengine.api.channel.ChannelPresence;
import com.google.appengine.api.channel.ChannelService;
import com.google.appengine.api.channel.ChannelServiceFactory;
@SuppressWarnings("serial")
public abstract class ChannelPresenceServlet extends HttpServlet {
final static Logger logger =
LoggerFactory.getLogger(ChannelPresenceServlet.class);
@Override
public void doGet(final HttpServletRequest req,
final HttpServletResponse resp)
throws IOException, ServletException
{
processCommand(req, resp);
}
@Override
public void doPost(final HttpServletRequest req,
final HttpServletResponse resp)
throws IOException, ServletException
{
processCommand(req, resp);
}
public void processCommand(final HttpServletRequest req,
final HttpServletResponse resp)
throws IOException, ServletException
{
final ChannelService channelService =
ChannelServiceFactory.getChannelService();
final ChannelPresence presence = channelService.parsePresence(req);
logger.info("Channel Presence - clientId={}, isConnected={}",
presence.clientId(), presence.isConnected());
}
}
任何幫助,將不勝感激。
如果我應該刪除這整個帖子,讓我知道。 – Chuck 2013-03-15 00:35:34