Foros de discusión

RE: exception in ResourceHandlerImpl.handleResourceRequest

PortletFaces Community Member, modificado hace 14 años.

exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
Hi all,

I developed a little portlet example using liferay 5.2 bundled version with tomcat-6.0.18, icefaces 2.0a2 , mojarra 2.0.3 snapshot and your bridge. A exception inside ResourceHandlerImpl.handleResourceRequest was thrown:

09:52:56,662 ERROR [jsp:?] org.portletfaces.bridge.BridgeException: java.lang.ClassCastException: com.liferay.portlet.ResourceRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest
org.portletfaces.bridge.BridgeException: java.lang.ClassCastException: com.liferay.portlet.ResourceRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest
at BridgeImpl.java.doFacesRequest(BridgeImpl.java:224)
at org.portletfaces.bridge.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:173)
at com.sun.portal.portletcontainer.appengine.filter.FilterChainImpl.doFilter(FilterChainImpl.java:177)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:76)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:100)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...
Caused by: java.lang.ClassCastException: com.liferay.portlet.ResourceRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest
at org.icefaces.push.servlet.ICEfacesResourceHandler.isResourceRequest(ICEfacesResourceHandler.java:114)
at org.portletfaces.bridge.application.ResourceHandlerImpl.handleResourceRequest(ResourceHandlerImpl.java:89)
at BridgeImpl.java.doFacesRequest(BridgeImpl.java:205)
... 106 more

The problem is inside this line:
if (wrappedResourceHandler.isResourceRequest(facesContext)) {

The reason is ICEfacesResourceHandler casts the request to HttpServletRequest when it is a PortletRequest...

More or less the same problem happened to me inside isResourceRequest (same file) in the line:
isResourceRequest = wrappedResourceHandler.isResourceRequest(facesContext);

Both problems happened to me about a month ago but I was affected by blank page after login issue. My portlet was just a demo/test and I changed this lines to avoid the problem (just not accessing the chain). So I am not in a hurry or similar, I am just trying to help.

Thanks!
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
You've come across a servlet-api dependency in ICEfaces 2.0-alpha that we're aware of and working on fixing with ICEsoft. At this time (April 2010) the bridge has only limited functionality when used with ICEfaces. The project schedule indicates that the bridge should have good compatibility with ICEfaces in late May, and then reach production quality by the end of June.
PortletFaces Community Member, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
Does this mean that currently the PortletFacesBridge works better with Mojarra? If I want to create jsf2 portlets for use with Liferay 6.0, is there a currently working method? I'm working on preparing the development environment for the future, so I understand that we are not quite there yet. But I'm just trying to make sure I know the options. Can you elaborate on this a little? I have gone through the presentation and checked out the code. I had trouble getting anything to run on Glassfish V3 -- which of course includes the jsf 2.0 implementation Mojarra. I am trying to work on the development setup for this. Really excited about the project and would be happy to contribute.

Thanks,
Geoff
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Yes at this time you can do Ajax type stuff with Mojarra's standard <f:ajax /> tag. ICEfaces compatibility is still about a month away. I've used the bridge in Liferay 6 and it works just as well as Liferay 6. There are some other threads in the forum about some GlassFish troubles. Right now we have to focus on getting the bridge to a feature-complete status, but then we can tackle other problems like app server troubles.
PortletFaces Community Member, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
I would be more than happy to help, I had posted the stack trace about the glassfish. I have the code checked out and would love to contribute. Are you interested in outside contribution? If you are any tips on how to get started working on the issue with glassfish v3 would be welcome and if there is a better forum for talking development, please let me know. I'd like to think I can help with this.
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Yes, thanks so much for the offer -- we'd be happy to receive the help if you can identify a fix for the glassfish problem, or any other problems you find. Otherwise we'll have to fix those at the end after development is complete. Picking up the glassfish issue on the glassfish thread would be best.
PortletFaces Community Member, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
I also tried tried first with liferay 5.2 + glassfish and I identified the exception was cos CDI (WELD). I think the problem was something similar to the one reported here, some servlet-api dependency... I got the same exception using tomcat when I integrated WELD inside it. So finally I just removed WELD cos I think problem is there.

Thanks again!
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
OK so if I understand you got the bridge working with Liferay 5.2 + Glassfish V3 by removing Weld?
PortletFaces Community Member, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
No, just the opposite... I checked that tomcat with WELD throws the same exception than in glassfish. I do not know how to remove weld from glassfish v3 (or even if it is possible).
PortletFaces Community Member, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
Finally I found the exception thrown by glassfish v3:

org.portletfaces.bridge.BridgeException: javax.faces.FacesException: Weld doesn not support using JSF in an non-servlet environment
at BridgeImpl.java.doFacesRequest(BridgeImpl.java:169)
at org.portletfaces.bridge.GenericFacesPortlet.doView(GenericFacesPortlet.java:194)
...
Caused by: javax.faces.FacesException: Weld doesn not support using JSF in an non-servlet environment
at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:136)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:115)
...
Caused by: java.lang.IllegalStateException: Weld doesn not support using JSF in an non-servlet environment
at org.jboss.weld.jsf.JsfHelper.getModuleBeanManager(JsfHelper.java:119)
at org.jboss.weld.jsf.WeldPhaseListener.initiateSessionAndConversation(WeldPhaseListener.java:168)

I think it is quite self explaining.
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
OK I have a friend that is helping with Weld maintenance issues. I'll ask him about it and see what he says.
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
The folks at JBoss asked me to file an issue for Weld:
https://jira.jboss.org/jira/browse/WELD-510
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
FYI, it is my best understanding that JBoss will be fixing https://jira.jboss.org/jira/browse/WELD-510 in Weld 1.1 (September 2010).
thumbnail
Neil Griffin, modificado hace 11 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
For updates on CDI/Weld integration with Liferay Faces Bridge, please refer to FACES-1211.
PortletFaces Community Member, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Regular Member Mensajes: 199 Fecha de incorporación: 3/04/12 Mensajes recientes
Thank you Neil,

I was just trying to help, if you were already aware about it is enough for me. Finally I used ICEFaces cos in your example you are using javax.faces.webapp.FacesServlet as JSF Servlet. As Geoffrey says... Would it be better to use mojarra 2.0.3 directly?

Thanks.
thumbnail
Neil Griffin, modificado hace 13 años.

RE: exception in ResourceHandlerImpl.handleResourceRequest

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
The mentioning of FacesServlet in web.xml is just there to get Mojarra to bootstrap properly. It's actually not used by the bridge for requests.