users@grizzly.java.net

Nullpointer in Comet

From: FredrikJ <fredrik_at_robotsociety.com>
Date: Mon, 8 Jun 2009 00:57:21 -0700 (PDT)

Hi,
I am getting this exception frequently when I am load testing my Comet
application:

java.lang.RuntimeException: java.lang.NullPointerException
        at
com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:110)
        at
com.sun.enterprise.web.connector.grizzly.comet.CometEngine.flushResponse(CometEngine.java:583)
        at
com.sun.enterprise.web.connector.grizzly.comet.CometEngine.resume(CometEngine.java:570)
        at
com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:487)
        at
com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler0(CometContext.java:451)
        at
com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:438)

This is basically what my CometHandler looks like:

public void onEvent(CometEvent event) throws IOException {
        try {
                ResultDTO result = (ResultDTO)event.attachment();
                String response = result.getBody();
                PrintWriter writer = response.getWriter();
                writer.write(text);
                writeToResponse(response);
        } finally {
                cometContext.resumeCometHandler(this);
        }
}

public void onInterrupt(CometEvent event) throws IOException {
        StringWriter writer = new StringWriter();
        XmlResponseBuilder.buildErrorResponse("error message");
        writeToResponse(writer.toString());
}

public void onTerminate(CometEvent event) throws IOException {}
public void onInitialize(CometEvent event) throws IOException {}

I am not sure why I am getting these NullPointers, the error message is not
very descriptive =)
Perhaps I am not using the API correctly?



-- 
View this message in context: http://www.nabble.com/Nullpointer-in-Comet-tp23919808p23919808.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.