Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

File upload in JSF Portlet

33 views
Skip to first unread message

chezh...@indiya.com

unread,
Aug 21, 2007, 10:49:52 AM8/21/07
to
Is IBM extended component for file upload (hx:fileUpload) supported in portal? When I tried to use this component in JSF Portlet, I getting ClassCastException ?Caused by: java.lang.ClassCastException: com.ibm.faces.portlet.httpbridge.ActionResponseWrapper?.

I am building JSF JSR168 portlet using RAD 7.0 and deploying it in Websphere Portal 6.0.1.

Read in blogs that ?hx:fileUpload? is not supported in Portal environments. Did anyone used this tag in Portlets? Suggestions are welcomed

yurykats

unread,
Aug 21, 2007, 4:16:20 PM8/21/07
to
FileUpload component should work in RAD7/WP6 combination.
What's the full stack trace for the exception?

chezh...@indiya.com

unread,
Aug 22, 2007, 4:56:53 AM8/22/07
to
Hi Yurykats

Full stack trace is below. Note: I have icu4j_3_4_1.jar, jsf-ibm.jar, jsf-impl-messages.jar, jsf-portletbridge.jar bundled in the Portlet war.


EventQueueMan E com.ibm.wps.pe.pc.std.event.EventQueueManager processEventLoop EJPPG1122E: An error occurred during portlet event processing.
javax.portlet.PortletException: java.lang.ClassCastException: com.ibm.faces.portlet.httpbridge.ActionResponseWrapper
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:251)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:168)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.action(PortletInvokerImpl.java:82)
at com.ibm.wps.pe.pc.std.event.ActionEvent.execute(ActionEvent.java:114)
at com.ibm.wps.pe.pc.std.event.EventQueueManager.processEventLoop(EventQueueManager.java:86)
at com.ibm.wps.pe.pc.std.PortletContainerImpl.performEvents(PortletContainerImpl.java:168)
at com.ibm.wps.pe.pc.PortletContainerImpl.performEvents(PortletContainerImpl.java:243)
at com.ibm.wps.engine.phases.WPActionPhase.processPortlets(WPActionPhase.java:1006)
at com.ibm.wps.engine.phases.WPActionPhase.execute(WPActionPhase.java:497)
at com.ibm.wps.state.phases.AbstractActionPhase.next(AbstractActionPhase.java:130)
at com.ibm.wps.engine.Servlet.callPortal(Servlet.java:768)
at com.ibm.wps.engine.Servlet.doGet(Servlet.java:609)
at com.ibm.wps.engine.Servlet.doPost(Servlet.java:794)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1521)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:136)
at com.ibm.wps.state.filter.StateCleanup.doFilter(StateCleanup.java:86)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.wps.mappingurl.impl.URLAnalyzer.doFilter(URLAnalyzer.java:263)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:121)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:82)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:759)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3071)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:236)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1958)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:98)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
Caused by: java.lang.ClassCastException: com.ibm.faces.portlet.httpbridge.ActionResponseWrapper
at com.ibm.faces.portlet.httpbridge.PortletExternalContextWrapper.encodeNamespace(PortletExternalContextWrapper.java:116)
at com.ibm.faces.portlet.UIPortletViewRoot.getClientId(UIPortletViewRoot.java:47)
at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:93)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:220)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91)
at com.ibm.faces.portlet.FacesPortlet.processAction(FacesPortlet.java:158)
at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.processAction(PortletFilterChainImpl.java:104)
at com.ibm.wps.propertybroker.standard.filter.PropertyBrokerActionFilter.processAction(PropertyBrokerActionFilter.java:261)
at com.ibm.wps.pe.pc.std.cmpf.impl.PortletFilterChainImpl.processAction(PortletFilterChainImpl.java:95)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.dispatch(PortletServlet.java:147)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletServlet.doPost(PortletServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at com.ibm.wps.pe.pc.std.cache.CacheablePortlet.service(CacheablePortlet.java:393)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1572)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:762)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:633)
at com.ibm.wps.pe.om.definition.impl.ServletDefinitionImpl$RDWrapper.include(ServletDefinitionImpl.java:419)
at com.ibm.wps.pe.pc.std.invoker.impl.PortletInvokerImpl.invoke(PortletInvokerImpl.java:204)
... 38 more

yurykats

unread,
Aug 22, 2007, 9:17:51 AM8/22/07
to
This does look like a problem in the bridge, in how clientId of the view is handled. However, to get to this state, I think, there must've been something else that went wrong in the UpdateModel phase, ie there is probaly something wrong with how you use the fileUpload component.
Can you show the tag and the associated java code?

chezh...@indiya.com

unread,
Aug 23, 2007, 4:31:17 AM8/23/07
to
Thanks yurykats,

I got it working. Created separate project and built the Portlet again using hx: fileUpload. I am not sure what did I do wrong in the previous project. See below for the code which was giving the ClassCastException.

<f:view><hx:scriptCollector id="scriptCollector1">
<p>Place content here.</p>
<h:form id="form1" styleClass="form">
<hx:fileupload id="fileupload1" styleClass="fileupload" value="#{file.fileData}" accept="application/msword,application/pdf,text/plain,image/jpeg,image/gif" >
<hx:fileProp name="fileName" />
<hx:fileProp name="contentType" />
</hx:fileupload>
<hx:commandExButton type="submit" value="Submit" id="button1" action="#{file.upload}"
styleClass="commandExButton"></hx:commandExButton>
</h:form>
</hx:scriptCollector>
</f:view>


private byte[] fileData=null;

public byte[] getFileData() {
return fileData;
}
public void setFileData(byte[] fileData) {
this.fileData = fileData;
}
public void upload()
{
System.out.println("Inside upload");
if(fileData!=null)
{
System.out.println("file size "+fileData.length);
}
}

chezh...@indiya.com

unread,
Aug 23, 2007, 9:33:33 AM8/23/07
to
I figured out reason for class cast exception.I had my getter/setter for hx:fileUpLoad wrong(typo). It is strange to get class cast exception for missing getter/setter methods..

yurykats

unread,
Aug 23, 2007, 11:47:13 AM8/23/07
to
As I said, the class cast exception is a red herring -- it is due to a bug in the bridge's code. The problem with your method names caused an exception during UpdateModel phase, which was caught by JSF and was being converted into an error message. During this error message creation, the bug in portlet bridge was hit that caused the class cast exception that you saw.

chezh...@indiya.com

unread,
Aug 24, 2007, 5:15:44 AM8/24/07
to
Thanks yurykats.
I understand the reason behind. I found few more class cast Exception (refer attach file) in portal log while saving the image in database (db2). The data is saved in many of these cases. I was trying with different queries using preparestatement/statement calls. I believe these errors are also due to portlet bridge problem.

In RAD 7.0 help, it is mentioned that hx:graphicImageEx (for binary data download) not supported for Faces Portlets. Is there any plan to include in future RAD releases.

Cheers
Elan

yurykats

unread,
Aug 24, 2007, 9:27:56 AM8/24/07
to
These exceptions seem to be coming from your upload method. What's in it?

I can't really comment on the future plans in the forum.

0 new messages