Reputation: 1870
I'm experiencing this with the SDK running locally on my Mac. I am trying to establish presence handling. I've created a simple servlet that does nothing but logging. However, I'm getting the following exception on any connection and disconnection event (though Channels appear to be working otherwise)...
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
I've registered that servlet for both connection and disconnection of channels in my web.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>
The handler (servlet) itself is quite basic...
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());
}
}
Any help would be appreciated.
Upvotes: 0
Views: 419
Reputation: 1870
How embarrassing. Cut and paste error. My servlet class was erroneously abstract. Sigh. Fixed.
I saw several other people complaining about the same exception under different circumstances, and at least one relating to Channel presence. If one other person realizes that they have mistakenly left a servlet class as abstract then I suppose this will have been beneficial.
Thanks to anyone who tried to follow me down the rat hole.
Upvotes: 1