Google 網路論壇不再支援新的 Usenet 貼文或訂閱項目,但過往內容仍可供查看。

File upload in JSF Portlet

瀏覽次數:33 次
跳到第一則未讀訊息

chezh...@indiya.com

未讀,
2007年8月21日 上午10:49:522007/8/21
收件者:
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

未讀,
2007年8月21日 下午4:16:202007/8/21
收件者:
FileUpload component should work in RAD7/WP6 combination.
What's the full stack trace for the exception?

chezh...@indiya.com

未讀,
2007年8月22日 凌晨4:56:532007/8/22
收件者:
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

未讀,
2007年8月22日 上午9:17:512007/8/22
收件者:
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

未讀,
2007年8月23日 凌晨4:31:172007/8/23
收件者:
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

未讀,
2007年8月23日 上午9:33:332007/8/23
收件者:
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

未讀,
2007年8月23日 上午11:47:132007/8/23
收件者:
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

未讀,
2007年8月24日 清晨5:15:442007/8/24
收件者:
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

未讀,
2007年8月24日 上午9:27:562007/8/24
收件者:
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 則新訊息