Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
Incidentally, THE RI for the JSR-301 and 328 bridges in the MyFaces project handles this correctly as well as many of the other 'gotchya's dealing with Remote vs. Local portals (like request scope spanning action/render). Sent from my iPhone On Apr 23, 2010, at 8:51 AM, Ate Douma a...@douma.nu wrote: On 04/23/2010 04:25 PM, Rossen Stoyanchev wrote: Hi- I can confirm I no longer see the issue recorded in PLUTO-591. Thanks for the quick fix! Good to hear, I resolved the issue as fixed. I now see another issue. I don't think is related to Pluto but I'll paste it here anyway in case someone has an idea: Caused by: java.lang.ClassCastException: org.apache.pluto.container.impl.RenderResponseImpl cannot be cast to javax.servlet.ServletResponse at com.sun.facelets.FaceletViewHandler.createResponseWriter (FaceletViewHandler.java:370) at com.sun.facelets.FaceletViewHandler.renderView (FaceletViewHandler.java:571) at org.springframework.faces.webflow.JsfView.render(JsfView.java:89) at org.springframework.webflow.engine.ViewState.render (ViewState.java:282) at org.springframework.webflow.engine.ViewState.doEnter (ViewState.java:186) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start (FlowExecutionImpl.java:364) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start (FlowExecutionImpl.java:222) Rendering is based on Facelets (not JSP's) and the Sun JSF Portlet bridge is version 1.2.5. That is a typical mistake made by portlet bridge solutions which assume a PortletRequest/Response is extending ServletRequest/Response. Pluto 1.x actually implemented it in that way (and a lot of other portlet containers). However the portlet spec doesn't require that at all, and with the implementation for Portlet Spec 2.0 (which is a lot more demanding) we discovered that extending ServletRequest/ServletResponse for the implementation of the PortletRequest/PortletResponse in fact causes many (logical) problems practically impossible to solve. So, Pluto 2.x no uses cleanroom implementations of PortletRequest/ PortletResponse and you cannot cast them anymore to ServletRequest/ ServletResponse. This therefore really needs to be solved by the Sun JSF Portlet bridge. Regards, Ate Thanks, Rossen
Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
Hi- I can confirm I no longer see the issue recorded in PLUTO-591. Thanks for the quick fix! I now see another issue. I don't think is related to Pluto but I'll paste it here anyway in case someone has an idea: Caused by: java.lang.ClassCastException: org.apache.pluto.container.impl.RenderResponseImpl cannot be cast to javax.servlet.ServletResponse at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:370) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571) at org.springframework.faces.webflow.JsfView.render(JsfView.java:89) at org.springframework.webflow.engine.ViewState.render(ViewState.java:282) at org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:186) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222) Rendering is based on Facelets (not JSP's) and the Sun JSF Portlet bridge is version 1.2.5. Thanks, Rossen
Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
On 04/23/2010 04:25 PM, Rossen Stoyanchev wrote: Hi- I can confirm I no longer see the issue recorded in PLUTO-591. Thanks for the quick fix! Good to hear, I resolved the issue as fixed. I now see another issue. I don't think is related to Pluto but I'll paste it here anyway in case someone has an idea: Caused by: java.lang.ClassCastException: org.apache.pluto.container.impl.RenderResponseImpl cannot be cast to javax.servlet.ServletResponse at com.sun.facelets.FaceletViewHandler.createResponseWriter(FaceletViewHandler.java:370) at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:571) at org.springframework.faces.webflow.JsfView.render(JsfView.java:89) at org.springframework.webflow.engine.ViewState.render(ViewState.java:282) at org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:186) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222) Rendering is based on Facelets (not JSP's) and the Sun JSF Portlet bridge is version 1.2.5. That is a typical mistake made by portlet bridge solutions which assume a PortletRequest/Response is extending ServletRequest/Response. Pluto 1.x actually implemented it in that way (and a lot of other portlet containers). However the portlet spec doesn't require that at all, and with the implementation for Portlet Spec 2.0 (which is a lot more demanding) we discovered that extending ServletRequest/ServletResponse for the implementation of the PortletRequest/PortletResponse in fact causes many (logical) problems practically impossible to solve. So, Pluto 2.x no uses cleanroom implementations of PortletRequest/PortletResponse and you cannot cast them anymore to ServletRequest/ServletResponse. This therefore really needs to be solved by the Sun JSF Portlet bridge. Regards, Ate Thanks, Rossen
Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
Apologies once more for the duplicate mailings. It seems using the forum pages(http://old.nabble.com/Apache-Pluto-f14378.html) doesn't work too well. No response to the message below? - Hi, Firstly, I apologize for having my message go out multiple times. I was using a forum page (http://old.nabble.com/Pluto---User-f200.html) that continues to show 0 replies and a warning that the message has not been accepted. I can't see why that is. I've subscribed to the mailing list but I don't get any emails either. At the end I found the responses on the mailing list archive. Not sure what I'm doing wrong. @Martin, with regards to your suggestions, did you mean to point to this source? http://fisheye5.cenqua.com/browse/glassfish/appserv-jstl/src/org/apache/taglibs/standard/tag/common/core/ImportSupport.java?r=1.5k= The class cast fails on com.sun.faces.portlet.ByteArrayWebOutputStream (as opposed to java.io.ByteArrayOutputStream). I'm not sure why changing the above source code would have any impact? Also the application is using JSF with Facelets, there is no jstl usage. The reason I pointed to HttpServletPortletResponseWrapper is because it calls javax.portlet.MimeResponse.getOutputStream(). For good or for bad the JavaDoc for that method says it returns a plain java.io.OutputStream: http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/MimeResponse.html#getPortletOutputStream() Instead of casting to ServletOutputStream, couldn't HttpServletPortletResponseWrapper create an instance of ServletOutputStream that wraps the OutputStream returned by MimeResponse? Thanks, Rossen
Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
On 04/22/2010 09:14 PM, Rossen Stoyanchev wrote: Apologies once more for the duplicate mailings. It seems using the forum pages(http://old.nabble.com/Apache-Pluto-f14378.html) doesn't work too well. No problem. No response to the message below? Sorry, I saw your reply yesterday but haven't had the time yet to properly read or comment on. Will try to do so tomorrow. Regards, Ate - Hi, Firstly, I apologize for having my message go out multiple times. I was using a forum page (http://old.nabble.com/Pluto---User-f200.html) that continues to show 0 replies and a warning that the message has not been accepted. I can't see why that is. I've subscribed to the mailing list but I don't get any emails either. At the end I found the responses on the mailing list archive. Not sure what I'm doing wrong. @Martin, with regards to your suggestions, did you mean to point to this source? http://fisheye5.cenqua.com/browse/glassfish/appserv-jstl/src/org/apache/taglibs/standard/tag/common/core/ImportSupport.java?r=1.5k= The class cast fails on com.sun.faces.portlet.ByteArrayWebOutputStream (as opposed to java.io.ByteArrayOutputStream). I'm not sure why changing the above source code would have any impact? Also the application is using JSF with Facelets, there is no jstl usage. The reason I pointed to HttpServletPortletResponseWrapper is because it calls javax.portlet.MimeResponse.getOutputStream(). For good or for bad the JavaDoc for that method says it returns a plain java.io.OutputStream: http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/MimeResponse.html#getPortletOutputStream() Instead of casting to ServletOutputStream, couldn't HttpServletPortletResponseWrapper create an instance of ServletOutputStream that wraps the OutputStream returned by MimeResponse? Thanks, Rossen
RE: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
take a look at the source NOT the doc org.apache.pluto.container.impl.HttpServletPortletResponseWrapper @Override public ServletOutputStream getOutputStream() throws IOException { return mimeResponse != null ? (ServletOutputStream)mimeResponse.getPortletOutputStream() : DummyServletOutputStream.getInstance(); } and the call to javax.portlet.MimeResponse.getPortletOutputStream does return back an OutputStream 355 public java.io.OutputStream getPortletOutputStream() 356 throws java.io.IOException; i downloaded pluto and the portlet-spec-2.0 then did a system wide grep for ByteArrayOutputWebOutputStream and found \Plutogrep -S -l ByteArrayWebOutputStream *.java i have dl latest Pluto 2.0 container sources and the latest portlet-2.0 from http://svn.apache.org/repos/asf/portals/portlet-spec/trunk/portlet-api_2.0_spec/ so my advice to you is grab the latest source ..build the jar and deploy it OR take the java class with wrong signature org.apache.pluto.container.impl.HttpServletPortletResponseWrapper.java and change the signature so getOutputStream method returns ServletOutputStream instead of incorrect com.sun.faces.portlet.ByteArrayWebOutputStream Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Thu, 22 Apr 2010 20:14:05 +0100 From: rstoyanc...@vmware.com To: pluto-user@portals.apache.org Subject: Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0 Apologies once more for the duplicate mailings. It seems using the forum pages(http://old.nabble.com/Apache-Pluto-f14378.html) doesn't work too well. No response to the message below? - Hi, Firstly, I apologize for having my message go out multiple times. I was using a forum page (http://old.nabble.com/Pluto---User-f200.html) that continues to show 0 replies and a warning that the message has not been accepted. I can't see why that is. I've subscribed to the mailing list but I don't get any emails either. At the end I found the responses on the mailing list archive. Not sure what I'm doing wrong. @Martin, with regards to your suggestions, did you mean to point to this source? http://fisheye5.cenqua.com/browse/glassfish/appserv-jstl/src/org/apache/taglibs/standard/tag/common/core/ImportSupport.java?r=1.5k= The class cast fails on com.sun.faces.portlet.ByteArrayWebOutputStream (as opposed to java.io.ByteArrayOutputStream). I'm not sure why changing the above source code would have any impact? Also the application is using JSF with Facelets, there is no jstl usage. The reason I pointed to HttpServletPortletResponseWrapper is because it calls javax.portlet.MimeResponse.getOutputStream(). For good or for bad the JavaDoc for that method says it returns a plain java.io.OutputStream: http://portals.apache.org/pluto/portlet-2.0-apidocs/javax/portlet/MimeResponse.html#getPortletOutputStream() Instead of casting to ServletOutputStream, couldn't HttpServletPortletResponseWrapper create an instance of ServletOutputStream that wraps the OutputStream returned by MimeResponse? Thanks, Rossen _ The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
Re: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
Jeez, you already had two replies on this question so far, seems though you're not receiving them? At any rate, repeatedly asking the same question within a single day is a bit much don't you think... If the previous responses didn't reach your emailbox I suggest try using web mail archives instead, like: http://mail-archives.apache.org/mod_mbox/portals-pluto-user/201004.mbox/browser Cc'ing on your personal email account(s) in the hope this one will get through to you. Regards, Ate On 04/21/2010 06:39 PM, Rossen Stoyanchev wrote: Hi, I am attempting to use Sun's jsf-portlet integration with Pluto 2.0. I get the following: Caused by: java.lang.ClassCastException: com.sun.faces.portlet.ByteArrayWebOutputStream cannot be cast to javax.servlet.ServletOutputStream at org.apache.pluto.container.impl.HttpServletPortletResponseWrapper.getOutputStream(HttpServletPortletResponseWrapper.java:234) at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:792) at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488) at org.apache.pluto.container.impl.PortletRequestDispatcherImpl.doDispatch(PortletRequestDispatcherImpl.java:174) at org.apache.pluto.container.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:227) at com.sun.faces.portlet.ExternalContextImpl.dispatch(ExternalContextImpl.java:147) at org.springframework.faces.webflow.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:25) at com.sun.faces.portlet.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:371) at com.sun.faces.portlet.ViewHandlerImpl.renderView(ViewHandlerImpl.java:235) at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:91) at org.springframework.faces.webflow.JsfView.render(JsfView.java:89) at org.springframework.webflow.engine.ViewState.render(ViewState.java:282) at org.springframework.webflow.engine.ViewState.doEnter(ViewState.java:186) at org.springframework.webflow.engine.State.enter(State.java:194) at org.springframework.webflow.engine.Flow.start(Flow.java:535) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:364) at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:222) ... 69 more The JavaDocs for javax.portlet.MimeResponse indicates the getPortletOutputStream() method return value is of type java.io.OutputStream. Hence the cast to javax.servlet.ServletOutputStream in HttpServletPortletResponseWrapper seems dodgy. Can you confirm if this is indeed an issue with Pluto's implementation or not? Thanks, Rossen
RE: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0
nothing dodgy about the pluto code the problem is with your JSF code as the pluto returns ServletOutputStream as seen below org.apache.pluto.container.impl.HttpServletPortletResponseWrapper extends HttpServletResponseWrapper @Override public ServletOutputStream getOutputStream() throws IOException { return mimeResponse != null ? (ServletOutputStream)mimeResponse.getPortletOutputStream() : DummyServletOutputStream.getInstance(); } //there is one ref to ByteArrayOutputStream which doesnt make sense since ImportSupport$ImportResponseWrapper is extending HttpServletResponseWrapper: class org.apache.taglibs.standard.tag.common.core.ImportSupport$ImportResponseWrapper extends javax.servlet.http.HttpServletResponseWrapper{ public org.apache.taglibs.standard.tag.common.core.ImportSupport$ImportResponseWrapper(org.apache.taglibs.standard.tag.common.core.ImportSupport, javax.servlet.http.HttpServletResponse); public java.io.PrintWriter getWriter(); public javax.servlet.ServletOutputStream getOutputStream(); public void setContentType(java.lang.String); public void setLocale(java.util.Locale); public void setStatus(int); public int getStatus(); public java.lang.String getString() throws java.io.UnsupportedEncodingException; static java.io.ByteArrayOutputStream access$000(org.apache.taglibs.standard.tag.common.core.ImportSupport$ImportResponseWrapper); } 2 suggestions: get the source http://fisheye5.cenqua.com/browse/glassfish/appserv-jstl/src/org/apache/taglibs/standard/tag/common/core/ImportSupport.java?r=1.5k= 1)change all java.io.ByteArrayOutputStream to javax.servlet.ServletOutputStream (HTTP input and output streams are text streams) 2)make a method which will cast ServletOutputStream to ByteArrayOutputStream e.g. downcast to java.io.OutputStream then upcast to ByteArrayOutputStream http://java.sun.com/j2se/1.4.2/docs/api/java/io/ByteArrayOutputStream.html Viel Gluck, Martin Gainty __ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Tue, 20 Apr 2010 14:04:10 -0700 From: rstoya05-...@yahoo.com To: pluto-user@portals.apache.org Subject: ClassCastException using Sun's jsf-portlet.jar in Pluto 2.0 Hi, I am attempting to use Sun's jsf-portlet integration with Pluto 2.0. I get the following: Caused by: java.lang.ClassCastException: com.sun.faces.portlet.ByteArrayWebOutputStream cannot be cast to javax.servlet.ServletOutputStream at org.apache.pluto.container.impl.HttpServletPortletResponseWrapper.getOutputStream(HttpServletPortletResponseWrapper.java:234) at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:792) at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488) at org.apache.pluto.container.impl.PortletRequestDispatcherImpl.doDispatch(PortletRequestDispatcherImpl.java:174) at org.apache.pluto.container.impl.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:227) at com.sun.faces.portlet.ExternalContextImpl.dispatch(ExternalContextImpl.java:147) at org.springframework.faces.webflow.ExternalContextWrapper.dispatch(ExternalContextWrapper.java:25) at com.sun.faces.portlet.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:371) at