组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
VELMURUGAN SUBRAMANIAN
ClassCastException: com.liferay.portlet.ResourceResponseImpl cannot be cast
2011年4月28日 上午9:48
答复

VELMURUGAN SUBRAMANIAN

等级: New Member

帖子: 5

加入日期: 2011年1月10日

最近的帖子

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
2011年4月28日 下午3:45
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 2337

加入日期: 2005年7月26日

最近的帖子

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
2011年4月29日 下午4:35
答复

VELMURUGAN SUBRAMANIAN

等级: New Member

帖子: 5

加入日期: 2011年1月10日

最近的帖子

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
2011年4月29日 下午5:05
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 2337

加入日期: 2005年7月26日

最近的帖子

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
2012年4月11日 上午6:06
答复

Johann Kneringer

等级: Junior Member

帖子: 42

加入日期: 2011年11月10日

最近的帖子

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
2012年4月11日 上午7:44
答复

Neil Griffin

LIFERAY STAFF

等级: Liferay Legend

帖子: 2337

加入日期: 2005年7月26日

最近的帖子

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
2012年4月12日 上午12:48
答复

Johann Kneringer

等级: Junior Member

帖子: 42

加入日期: 2011年11月10日

最近的帖子

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
2012年5月20日 上午1:31
答复

Ashish Renapurkar

等级: New Member

帖子: 23

加入日期: 2012年1月18日

最近的帖子

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