Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
VELMURUGAN SUBRAMANIAN
ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be cast
28 de Abril de 2011 09:48
Resposta

VELMURUGAN SUBRAMANIAN

Ranking: New Member

Mensagens: 5

Data de entrada: 10 de Janeiro de 2011

Mensagens recentes

Hi all,
I've used the below code to generate resource Url for PDF download link in my portlet.

1
2<portlet:resourceURL id="myPDF" var="myRenderURL"  >
3            <portlet:param name="ln" value="metricsPDFExport" />
4            <portlet:param name="javax.faces.resource" value="export" />
5        </portlet:resourceURL>
6
7        <a href="#{myRenderURL}" target="_blank">Export PDF</a>


When the page renders for the first time, I cannot see any issues during the render phase of the portlet and as well as resource URL also generates very well. Even I'm able to download PDF file using the Url link generated during render phase while using custom Resource Handler class implementation which I followed, http://www.liferay.com/community/liferay-projects/liferay-faces/demos#jsf2-export-pdf-portlet.

But instead of generating the unique resource URL from the server side, I'm trying to generate from xhtml page as mentioned above.

In this case, all other events (ValueChangeListener, ActionListener,RowSelectListener etc) stopped working properly. These events are triggered as expected and after this render phase kicks in to reload the page where I'm getting the below exception.

 1
 214:43:43,296 DEBUG [ExternalContextImpl:899] request parameter _facesViewId=[/xhtml/portletViewMode.xhtml]
 3accountValueChangeListener() [newAccountNumber:45330]  [oldAccountNumber:null
 414:43:43,359 DEBUG [PortletContainerImpl:39] createActionURL fromURL=[/performancemetricsportlet/xhtml/portletViewMode.xhtml]
 514:43:43,359 DEBUG [PortletContainerImpl:39] createActionURL fromURL=[/performancemetricsportlet/xhtml/portletViewMode.xhtml]
 614:43:43,359 DEBUG [PortletContainerImpl:39] createPartialActionURL fromURL=[/performancemetricsportlet/xhtml/portletViewMode.xhtml]
 714:43:43,359 DEBUG [PortletContainerImpl:39] createResourceURL fromURL=[/performancemetricsportlet/xhtml/portletViewMode.xhtml]
 8java.lang.ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be cast to javax.portlet.RenderResponse
 9    at org.portletfaces.bridge.renderkit.portlet.ResourceURLRenderer.encodeEnd(ResourceURLRenderer.java:45)
10    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:879)
11    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1655)
12    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
13    at javax.faces.render.Renderer.encodeChildren(Renderer.java:164)
14    at org.icefaces.impl.renderkit.RendererWrapper.encodeChildren(RendererWrapper.java:54)
15    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:849)
16    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1648)
17    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)
18    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1651)


I'm using below jsf and portlet bridge versions in my portlet.

1. portletfaces-bridge-2.0.0-RC1.jar
2. jsf-api-2.0.4-b06.jar
3. jsf-impl-2.0.4-b06.jar

Please let me know what I'm doing wrong here?

Thanks
Velu
Neil Griffin
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
28 de Abril de 2011 15:45
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2189

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Whoops, that's a bug in the bridge. Sorry about that -- it's fixed in the source repository now, and will appear in version 2.0.1 when released. See: http://issues.liferay.com/browse/FACES-234
VELMURUGAN SUBRAMANIAN
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
29 de Abril de 2011 16:35
Resposta

VELMURUGAN SUBRAMANIAN

Ranking: New Member

Mensagens: 5

Data de entrada: 10 de Janeiro de 2011

Mensagens recentes

Thanks Neil, Checked out the fix from the source repository, packaged as jar file and added to application build path. Worked like a charm. emoticon

Though with the fix, I could not able to achieve what I'm looking for. Here is the thing I'm trying to download a pdf.

There is an ice faces form which contains few selection criterias built using icefaces component like drop down and radio button (html and pdf) and one generate report command button.

When the user select either report type (html/pdf), I've to validate the form first, and if validation succeeds, then need to populate JSF model bean.

From this newly populated bean, I generate PDF object and need to send it back to the user's browser.

Portlet faces pdf example explains the part of downloading the pdf by initiating the portlet life cycle as RESOURCE_PHASE. So, I could not able to decode your pdf export example on how to call validation phase, get the input stream object from my backing bean and write it to RESOURCE_PHASE response stream.

Your help on this matter will be highly appreciable.

Thanks
Velu
Neil Griffin
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
29 de Abril de 2011 17:05
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2189

Data de entrada: 26 de Julho de 2005

Mensagens recentes

With a UI like this that requires validation, I would recommend that you make the download link disabled="true" or rendered="false" until the validation passes.
Johann Kneringer
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
11 de Abril de 2012 06:06
Resposta

Johann Kneringer

Ranking: Junior Member

Mensagens: 40

Data de entrada: 10 de Novembro de 2011

Mensagens recentes

Hi Neil,

is this issue similar to this exception?


14:59:22,666 ERROR [IPCPhaseListener:57] com.liferay.portlet.ResourceResponseImpl cannot be cast to javax.portlet.StateAwareResponse
java.lang.ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be cast to javax.portlet.StateAwareResponse
at org.portletfaces.bridge.event.IPCPhaseListener.processOutgoingPublicRenderParameters(IPCPhaseListener.java:211)

Is it fixed in the current version of portletfaces-bridge?

regards,
Johann
Neil Griffin
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
11 de Abril de 2012 07:44
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2189

Data de entrada: 26 de Julho de 2005

Mensagens recentes

Hi Johann,

If you have time, please give Liferay Faces Bridge 3.0.0-BETA1 a test drive and let me know if you still run into the ClassCastException.

Thanks,

Neil
Johann Kneringer
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
12 de Abril de 2012 00:48
Resposta

Johann Kneringer

Ranking: Junior Member

Mensagens: 40

Data de entrada: 10 de Novembro de 2011

Mensagens recentes

Unfortunatly I cannot reproduce the problem on my developementserver (which is 6.2, because of issues with hot deployment in liferay IDE with version 6.1 GA).

On my liveserver there I run version 6.1 GA where this error is shown, so I guess the error is fixed in 6.2...

Thanks anyways...
Ashish Renapurkar
RE: ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be
20 de Maio de 2012 01:31
Resposta

Ashish Renapurkar

Ranking: New Member

Mensagens: 23

Data de entrada: 18 de Janeiro de 2012

Mensagens recentes

Neil Griffin:
Hi Johann,

If you have time, please give Liferay Faces Bridge 3.0.0-BETA1 a test drive and let me know if you still run into the ClassCastException.

Thanks,

Neil



Hello Neil,

Thanks for this update. It will solve my problem. Thanks againemoticon