users@grizzly.java.net

strange exception

From: Cam Bazz <cambazz_at_gmail.com>
Date: Sat, 13 Sep 2008 14:51:23 +0300

Hello,

I get (only sometimes)

The log message is null.
java.lang.NullPointerException
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.registerKey(DefaultReadTask.java:438)
        at com.sun.enterprise.web.connector.grizzly.AsyncReadTask.terminate(AsyncReadTask.java:174)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.taskEvent(DefaultReadTask.java:365)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.fireTaskEvent(TaskBase.java:234)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.terminateProcess(DefaultProcessorTask.java:792)
        at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.postExecute(DefaultAsyncExecutor.java:191)
        at com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:99)
        at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.flushResponse(CometEngine.java:534)
        at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.resume(CometEngine.java:521)
        at com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:433)
        at com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:399)
        at handlers.StatsHandler.onEvent(StatsHandler.java:30)
        at com.sun.enterprise.web.connector.grizzly.comet.DefaultNotificationHandler.notify0(DefaultNotificationHandler.java:188)
        at com.sun.enterprise.web.connector.grizzly.comet.DefaultNotificationHandler.notify0(DefaultNotificationHandler.java:113)
        at com.sun.enterprise.web.connector.grizzly.comet.DefaultNotificationHandler$1.doTask(DefaultNotificationHandler.java:102)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
Notification failed:
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:534)
        at com.sun.enterprise.web.connector.grizzly.comet.CometEngine.resume(CometEngine.java:521)
        at com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:433)
        at com.sun.enterprise.web.connector.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:399)
        at handlers.StatsHandler.onEvent(StatsHandler.java:30)
        at com.sun.enterprise.web.connector.grizzly.comet.DefaultNotificationHandler.notify0(DefaultNotificationHandler.java:188)
        at com.sun.enterprise.web.connector.grizzly.comet.DefaultNotificationHandler.notify0(DefaultNotificationHandler.java:113)
        at com.sun.enterprise.web.connector.grizzly.comet.DefaultNotificationHandler$1.doTask(DefaultNotificationHandler.java:102)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116)
Caused by: java.lang.NullPointerException
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.registerKey(DefaultReadTask.java:438)
        at com.sun.enterprise.web.connector.grizzly.AsyncReadTask.terminate(AsyncReadTask.java:174)
        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.taskEvent(DefaultReadTask.java:365)
        at com.sun.enterprise.web.connector.grizzly.TaskBase.fireTaskEvent(TaskBase.java:234)
        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.terminateProcess(DefaultProcessorTask.java:792)
        at com.sun.enterprise.web.connector.grizzly.async.DefaultAsyncExecutor.postExecute(DefaultAsyncExecutor.java:191)
        at com.sun.enterprise.web.connector.grizzly.async.AsyncProcessorTask.doTask(AsyncProcessorTask.java:99)
        ... 10 more

It is triggered at event.getCometContext().resumeCometHandler(this) from:

    public void onEvent(CometEvent event) throws IOException {
        if(CometEvent.NOTIFY == event.getType()) {
            PrintWriter writer = response.getWriter();
            String[] attachment = (String[]) event.attachment();
            response.addHeader("X-CON", attachment[0]);
            response.addHeader("X-UNQ", attachment[1]);
            response.addHeader("X-LVE", attachment[2]);
            writer.write("success");
            writer.flush();
            event.getCometContext().resumeCometHandler(this);
        }
    }

any ideas?