users@grizzly.java.net

How to update grizzly jar with GlassFish v3 Prelude

From: aalcamo <aalcamo_at_gofurthercorp.com>
Date: Wed, 10 Dec 2008 11:27:26 -0800 (PST)

I would like to update to a later version of grizzly using GlassFish v3
Prelude. I am using NetBeans 6.5 for my IDE. Specifically, I am running
into an issue when trying to send a message from a GF servlet to a client
using the DeliverResponse, and I get the following exception:

SEVERE:java.lang.NullPointerException
SEVERE:at
com.sun.grizzly.arp.AsynchronousOutputBuffer.flushChannel(AsynchronousOutputBuffer.java:86)

My exception seems to be similar to issue 325 (the information posted on
Project Grizzly indicates that issue 325 has been resolved):
https://grizzly.dev.java.net/issues/show_bug.cgi?id=325

My servlet code that sends data to the client is below.
Any help would be appreciated.
Thank you,
Anthony

public class TestServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request,
            HttpServletResponse response) throws ServletException,
IOException {
        //doProcess(request, response);
        broadcast(request, response);
    }

    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException,
IOException {
        //doProcess(request, response);
        broadcast(request, response);
    }

    protected void broadcast(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {

        // joins add to the session map, leaves remove from the session map
        Map channelMap =
(Map)getServletContext().getAttribute("channellist");
        String contextPath = "/dojoComet/cometd";
        CometEngine engine = CometEngine.getEngine();
        CometContext context = engine.getCometContext(contextPath);
        DeliverResponse deliverResponse = new DeliverResponse();

        Map map = new HashMap();
        map.put("merchantID", "48U");
        Data data = new Data();
        data.setMapData(map);

        Set keys = channelMap.keySet();
        Iterator it = keys.iterator();
        String key = "Anthony";

        deliverResponse.setChannel("/chat/"+key);
        //deliverResponse.setClientId(""); // fixes older cometd bug
        deliverResponse.setData(data);
        deliverResponse.setLast(true);
        deliverResponse.setFollow(true);
        try{
            context.notify(deliverResponse);
            System.out.println("message sent to "+key);
        }catch(IllegalMonitorStateException imse){
            imse.printStackTrace();
        }
    }
}
-- 
View this message in context: http://www.nabble.com/How-to-update-grizzly-jar-with-GlassFish-v3-Prelude-tp20942375p20942375.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.