Hi,
Do you see any errors in log in v3 Prelude?
I am in GlassFish v3 trunk. When I deploy a grizzly-cometd-echo.war
described in my blog
and try to run it, I see the following:
[#|2008-12-09T16:37:03.156-0800|SEVERE|glassfish|javax.enterprise.system.container.web|_ThreadID=17;_ThreadName=Thread-3;|StandardWrapperValve[Grizzly
Cometd Servlet]: PWC1406: Servlet.service() for servlet Grizzly Cometd
Servlet threw exception
java.lang.ClassCastException:
com.sun.grizzly.cometd.servlet.CometdServlet$1 cannot be cast to
com.sun.grizzly.cometd.CometdResponse
at
com.sun.grizzly.cometd.servlet.CometdServlet.doPost(CometdServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:465)
at
org.apache.catalina.core.StandardWrapperValve.preInvoke(StandardWrapperValve.java:464)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:139)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:186)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:719)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:657)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:96)
at
com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
Look like something is broken.
Regards,
Shing Wai Chan
aalcamo wrote:
> I am having a similar problem. I have installed the latest Glassfish v3
> Prelude, and using Shing Wai's example to send messages via a servlet to the
> clients using the DeliverResponse object. I have spent many hours trying to
> upgrade to a later version of grizzly cometd but without success. My code
> seems to execute without exception now, but the clients do not get the
> messages sent by the servlet. I'm testing using NetBeans6.5, and several
> MSIE7 clients. My 'broadcast message' code is below. Please let me know if
> there is any other info or files that I might provide. Thank you for any
> help.
>
> // code within my TestServlet.java
> .
> .
>
> 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");
> if(request.getParameter("broadcast")!=null){
>
> String contextPath = "/dojoComet/cometd";
> CometEngine engine = CometEngine.getEngine();
> CometContext context = engine.getCometContext(contextPath);
> DeliverResponse deliverResponse = new DeliverResponse();
> ServletOutputStream out = response.getOutputStream();
>
> // IVR sends ID, type, call ID, and NIDs
> //String id = request.getParameter("client");
> String id="Carl"; // using canned value for now
> double callID = 12345678901234567890D;
> String type = "sales_exchange";
> String nid = "48U";
>
> Map map = new HashMap();
> map.put("id", id);
> map.put("callID", callID);
> map.put("type", type);
> map.put("nid", nid);
> Data data = new Data();
> data.setMapData(map);
>
> Set keys = channelMap.keySet();
> Iterator it = keys.iterator();
> String key = null;
> out.println("<html><body>");
> while(it.hasNext()){
> // just use the key since key name and channel are same for
> now
> key = (String)channelMap.get(it.next());
> deliverResponse.setChannel("/chat/"+key);
> deliverResponse.setClientId(""); // fixes older cometd bug
> deliverResponse.setData(data);
> deliverResponse.setLast(true);
> deliverResponse.setFollow(true);
> try{
> context.notify(deliverResponse);
> out.println("message sent to "+key+"<br/>");
> }catch(IllegalMonitorStateException imse){
> imse.printStackTrace();
> }finally{
> out.println("</body></html>");
> }
> }
> }
> }
>
>
>