2 Replies Latest reply on Dec 12, 2011 4:42 AM by Eduardo Mello Cantú

    GateIn Portlet Container

    Eduardo Mello Cantú Newbie

      Hi there.

       

      I've developed a portal application using GateIn Portlet Container 2.1.0-CR02, JBoss Seam 2.2.2.Final, Richfaces 3.3.3, Facelets 1.1.15.B1.

       

      When I deploy simple portlets, like the ones made up with plain jsf tags, I have no problem at all, but when I try to deploy a portlet made with seam, richfaces, facelets along with jboss portlet bridge I have a ClassCastException (as you can see below).

       

      By investigentin further I discovered that it happens because the portal application was load by a different classloader than the portlet.

       

      My doubt is: it is possible to work on a alternative so I can use richfaces on my portlet application? I've tried this combination both on JBoss 4.2.3.GA and JBoss 7.1.0.Beta1.

       

      On JBoss AS 4.2.3.GA I've managed to make it work, but I've to share the same classloader between portal application and portlet.

       

      11:56:53,328 ERROR [org.gatein.pc.container.javax_portlet_faces_GenericFacesPortlet] (http--0.0.0.0-8080-5) The portlet threw an exception: javax.portlet.PortletException: Error process faces request

                at javax.portlet.faces.GenericFacesPortlet.doFacesDispatch(GenericFacesPortlet.java:630) [portletbridge-api-2.2.0.FINAL.jar:]

                at javax.portlet.faces.GenericFacesPortlet.doView(GenericFacesPortlet.java:518) [portletbridge-api-2.2.0.FINAL.jar:]

                at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:328) [portlet-api.jar:]

                at javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:489) [portletbridge-api-2.2.0.FINAL.jar:]

                at javax.portlet.GenericPortlet.render(GenericPortlet.java:233) [portlet-api.jar:]

                at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:568) [pc-portlet.jar:]

                at org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:159) [pc-portlet.jar:]

                at org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:80) [pc-portlet.jar:]

                at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:505) [pc-portlet.jar:]

                at org.gatein.pc.portlet.container.ContainerPortletDispatcher.invoke(ContainerPortletDispatcher.java:42) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.EventPayloadInterceptor.invoke(EventPayloadInterceptor.java:196) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.RequestAttributeConversationInterceptor.invoke(RequestAttributeConversationInterceptor.java:119) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.CCPPInterceptor.invoke(CCPPInterceptor.java:65) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor.access$001(ContextDispatcherInterceptor.java:49) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor$1.doCallback(ContextDispatcherInterceptor.java:123) [pc-portlet.jar:]

                at org.gatein.wci.command.CommandDispatcher$CallbackCommand.execute(CommandDispatcher.java:82) [wci-wci.jar:]

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_16]

                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_16]

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [:1.6.0_16]

                at java.lang.reflect.Method.invoke(Unknown Source) [:1.6.0_16]

                at org.gatein.wci.command.CommandServlet.doGet(CommandServlet.java:135) [wci-wci.jar:]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:734) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:576) [jbossweb-7.0.3.Final.jar:]

                at org.gatein.wci.command.CommandServlet.include(CommandServlet.java:84) [wci-wci.jar:]

                at org.gatein.wci.command.CommandDispatcher.include(CommandDispatcher.java:58) [wci-wci.jar:]

                at org.gatein.wci.tomcat.TC6ServletContainerContext.include(TC6ServletContainerContext.java:87) [wci-tomcat.jar:]

                at org.gatein.wci.impl.DefaultServletContainer.include(DefaultServletContainer.java:191) [wci-wci.jar:]

                at org.gatein.pc.portlet.impl.spi.AbstractServerContext.dispatch(AbstractServerContext.java:69) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:77) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.SecureTransportInterceptor.invoke(SecureTransportInterceptor.java:69) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.ValveInterceptor.invoke(ValveInterceptor.java:75) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.container.ContainerPortletInvoker.invoke(ContainerPortletInvoker.java:117) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.state.producer.ProducerPortletInvoker.invoke(ProducerPortletInvoker.java:230) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.PortletCustomizationInterceptor.invoke(PortletCustomizationInterceptor.java:76) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portlet.aspects.ConsumerCacheInterceptor.invoke(ConsumerCacheInterceptor.java:162) [pc-portlet.jar:]

                at org.gatein.pc.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:87) [pc-portlet.jar:]

                at org.gatein.pc.portal.jsp.PagePortletControllerContext.invoke(PagePortletControllerContext.java:117)

                at org.gatein.pc.controller.impl.AbstractPortletControllerContext.invoke(AbstractPortletControllerContext.java:191)

                at org.gatein.pc.controller.PortletController.render(PortletController.java:235)

                at org.gatein.pc.portal.jsp.PortalRenderResponse.render(PortalRenderResponse.java:121)

                at org.gatein.pc.portal.jsp.PortalRenderResponse.render(PortalRenderResponse.java:138)

                at org.gatein.pc.portal.jsp.PortalRenderResponse.<init>(PortalRenderResponse.java:91)

                at org.gatein.pc.portal.jsp.ControllerFilter.doFilter(ControllerFilter.java:272)

                at org.gatein.pc.portal.jsp.ControllerFilter.doFilter(ControllerFilter.java:92)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]

                at org.gatein.pc.portal.ErrorHandlingFilter.doFilter(ErrorHandlingFilter.java:61)

                at org.gatein.pc.portal.ErrorHandlingFilter.doFilter(ErrorHandlingFilter.java:53)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) [jboss-seam.jar:]

                at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) [jboss-seam.jar:]

                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

                at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206) [richfaces-impl.jar:]

                at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290) [richfaces-impl.jar:]

                at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388) [richfaces-impl.jar:]

                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515) [richfaces-impl.jar:]

                at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

                at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:]

                at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:397) [jbossweb-7.0.3.Final.jar:]

                at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Beta1.jar:]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.Beta1.jar:]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.3.Final.jar:]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.3.Final.jar:]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.3.Final.jar:]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.3.Final.jar:]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.3.Final.jar:]

                at java.lang.Thread.run(Unknown Source) [:1.6.0_16]

      Caused by: javax.portlet.faces.BridgeException: javax.faces.FacesException: java.lang.ClassCastException: org.ajax4jsf.webapp.FilterServletResponseWrapper cannot be cast to org.ajax4jsf.webapp.FilterServletResponseWrapper

                at org.jboss.portletbridge.SeamExceptionHandlerImpl.handleException(SeamExceptionHandlerImpl.java:123) [portletbridge-impl-2.2.0.FINAL.jar:]

                at org.jboss.portletbridge.SeamExceptionHandlerImpl.processException(SeamExceptionHandlerImpl.java:63) [portletbridge-impl-2.2.0.FINAL.jar:]

                at org.jboss.portletbridge.ExceptionHandlerBase.processRenderException(ExceptionHandlerBase.java:62) [portletbridge-impl-2.2.0.FINAL.jar:]

                at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:695) [portletbridge-impl-2.2.0.FINAL.jar:]

                at javax.portlet.faces.GenericFacesPortlet.doFacesDispatch(GenericFacesPortlet.java:628) [portletbridge-api-2.2.0.FINAL.jar:]

                ... 97 more

      Caused by: javax.faces.FacesException: java.lang.ClassCastException: org.ajax4jsf.webapp.FilterServletResponseWrapper cannot be cast to org.ajax4jsf.webapp.FilterServletResponseWrapper

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:128) [jsf-impl-1.2_15-jbossorg-2.jar:]

                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-1.2_15-jbossorg-2.jar:]

                at org.jboss.portletbridge.AjaxPortletBridge.render(AjaxPortletBridge.java:1290) [portletbridge-impl-2.2.0.FINAL.jar:]

                at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:658) [portletbridge-impl-2.2.0.FINAL.jar:]

                ... 98 more

      Caused by: java.lang.ClassCastException: org.ajax4jsf.webapp.FilterServletResponseWrapper cannot be cast to org.ajax4jsf.webapp.FilterServletResponseWrapper

                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:184) [richfaces-impl.jar:]

                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) [jsf-impl-1.2_15-jbossorg-2.jar:]

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) [jsf-impl-1.2_15-jbossorg-2.jar:]

                ... 101 more

       

        • 1. Re: GateIn Portlet Container
          Antoine Herzog Master

          Hi,

           

          I am not sure this the answer, but it might...

           

          usually, to have RichFaces and the Portlet Bridge running in the portal, for portlets with jsf applications, etc... you have to organize properly the libraries.

           

          this way (here under), it runs nicely.

          It avoids the kind of trouble you found with "cannot cast"  exceptions.

           

          ********* Carefull organization of the jars in the libs folders

          you put :

          - in the lib of the EAR :

          richfaces-api-3.3.3.Final.jar

          portletbridge-api-2.1.0.FINAL.jar

          jsf-facelets-1.1.15.jar

           

          - in the lib of each WAR that are under the EAR :

          portletbridge-impl-2.1.0.FINAL.jar

          richfaces-impl-3.3.3.Final.jar

          richfaces-ui-3.3.3.Final.jar

           

          ******** always with an EAR ?

          This means : make your application in a EAR.

          I have not often tried some application directly in a single war (only one application, one war....).

          but as far as I remember, it works.

           

          It works with an EAR... which allows to then make severa War under it...

          so usually, I do this way.

           

           

          Please, tell here if this was the correct answer to make your portlet container run with RichFaces...

           

          Antoine Herzog

          Consultant JBoss Portal and GateIn (JSR-286), JSF, Richfaces, J2EE, Drools, BRMS.

          • 2. Re: GateIn Portlet Container
            Eduardo Mello Cantú Newbie

            Hey, thanks for the awnser, but I didn't have the time to test it on my app. As soon as I implement it I'll let you know about it.