users@grizzly.java.net

Re: Problem with Bayeux Servlet Client in GlassFish V3

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

My appologies - I found that I failed to call sendRedirect on the response
object.
e.g. response.sendRedirect("admin.jsp");
Anthony


aalcamo wrote:
>
> Shing Wai,
> Thank you for your quick response. I cleared my glassfish v3 prelude log
> this morning, redeployed the application, and captured the log (attached).
> The only thing I see is an exception because I tried to include the
> grizzly 1.9 archive as part of my project's libraries and this conflicts
> with the version/classes shipped with GFv3. Do you know of another simple
> example using prelude that shows how to communicate to back to a comet
> client using the servlet (instead of something like the dojo framework I
> use on the client side)?
> Thanks,
> Anthony
>
> [#|2008-12-10T09:33:06.910-0500|INFO|glassfish|javax.enterprise.system.container.web|_ThreadID=12;_ThreadName=Thread-3;|validateJarFile(C:\projects\dojoC\build\web\WEB-INF\lib\grizzly-cometd-webserver-1.9.0-20081001.021626-1.jar)
> - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class:
> javax/servlet/Servlet.class|#]
>
>
> Shing Wai Chan wrote:
>>
>> 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>");
>>> }
>>> }
>>> }
>>> }
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>>
>>
> http://www.nabble.com/file/p20936620/server.log server.log
>

-- 
View this message in context: http://www.nabble.com/Problem-with-Bayeux-Servlet-Client-in-GlassFish-V3-tp20810461p20961641.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.