6 Replies Latest reply on Sep 10, 2009 4:18 AM by joodie B

    JSF Portlet not rendering view - Jsf portletbridge bridge no

    Sreeni Jakka Newbie

      Hello
      I am trying to get a JSF/Facelets/RichFaces Portlet working in JBoss Portal using the PortletBridge.
      I finally get an empty portlet but no view content. I see the following errors in the log file:

      2008-07-07 14:46:56,794 DEBUG [org.jboss.portletbridge.context.FacesContextFactoryImpl] Servlet request - create HttpServlet version of the ExternalContext
      2008-07-07 14:46:56,882 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process before phase RESTORE_VIEW 1
      2008-07-07 14:46:56,882 DEBUG [org.ajax4jsf.event.InitPhaseListener] Perform additional framework initialization on first request
      2008-07-07 14:46:56,882 DEBUG [org.ajax4jsf.application.ViewHandlerWrapper] Create new instance of alternate handler class org.jboss.portletbridge.application.FaceletPortletViewHandler
      2008-07-07 14:46:57,039 DEBUG [org.ajax4jsf.event.InitPhaseListener] Remove init phase listener from factories
      2008-07-07 14:46:57,040 DEBUG [org.ajax4jsf.event.AjaxPhaseListener] Process after phase RESTORE_VIEW 1
      2008-07-07 14:46:57,050 WARN [javax.enterprise.resource.webcontainer.jsf.lifecycle] phase(RENDER_RESPONSE 6,org.jboss.portletbridge.context.FacesContextImpl@154e317) threw exception: javax.portlet.faces.BridgeException: Jsf portletbridge bridge not initialised Jsf portletbridge bridge not initialised
      org.jboss.portletbridge.application.PortletStateHolder.getInstance(PortletStateHolder.java:125)
      org.jboss.portletbridge.lifecycle.PortalPhaseListener.beforePhase(PortalPhaseListener.java:108)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
      org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
      org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
      org.jboss.portal.portlet.impl.jsr168.api.PortletRequestDispatcherImpl.include(PortletRequestDispatcherImpl.java:86)
      com.cypress.portal.BillingSummary.doView(BillingSummary.java:27)
      javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
      javax.portlet.faces.GenericFacesPortlet.doDispatch(GenericFacesPortlet.java:244)
      javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
      org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)

      Here is what I have in my libs:
      Rich Faces 3.2.0.GA jars
      jboss-portletbridge-1.0.0.B2 jars
      jsf-facelets.jar

      my faces-config.xml ---->
      <?xml version="1.0"?>
      <!DOCTYPE faces-config PUBLIC
      "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      <faces-config>


      <view-handler>
      org.jboss.portletbridge.application.PortletViewHandler
      </view-handler>
      <locale-config>
      <default-locale>en</default-locale>
      </locale-config>


      <faces-context-factory>
      org.jboss.portletbridge.context.FacesContextFactoryImpl
      </faces-context-factory>


      <managed-bean id="billingSummaryBean">
      <managed-bean-name>billingSummaryBean</managed-bean-name>
      <managed-bean-class>
      com.cypress.beans.BillingSummaryBean
      </managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>

      <render-kit>

      <component-family>javax.faces.ViewRoot</component-family>
      <renderer-type>javax.faces.ViewRoot</renderer-type>
      <renderer-class>
      org.jboss.portletbridge.renderkit.portlet.PortletAjaxViewRootRenderer
      </renderer-class>

      </render-kit>

      </faces-config>


      Here is my web.xml --->

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

      <context-param>
      <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
      <param-value>
      org.jboss.portletbridge.application.FaceletPortletViewHandler
      </param-value>
      </context-param>
      <context-param>
      <param-name>javax.portlet.faces.renderPolicy</param-name>
      <param-value>ALWAYS_DELEGATE</param-value>
      </context-param>
      <context-param>
      <param-name>
      javax.portlet.faces.preserveActionParams
      </param-name>
      <param-value>true</param-value>
      </context-param>
      <context-param>
      <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
      <param-value></param-value>
      </context-param>
      <context-param>
      <param-name>org.richfaces.LoadStyleStrategy</param-name>
      <param-value>NONE</param-value>
      </context-param>
      <context-param>
      <param-name>org.richfaces.LoadScriptStrategy</param-name>
      <param-value>NONE</param-value>
      </context-param>
      <context-param>
      <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
      <param-value>false</param-value>
      </context-param>


      <!-- JSF -->

      <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
      </context-param>

      <context-param>
      <param-name>org.richfaces.SKIN</param-name>
      <param-value>blueSky</param-value>
      </context-param>

      <context-param>
      <param-name>javax.faces.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config.xml</param-value>
      </context-param>

      <context-param>
      <param-name>facelets.DEVELOPMENT</param-name>
      <param-value>true</param-value>
      </context-param>

      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
      </context-param>


      <display-name>Ajax4jsf Filter</display-name>
      <filter-name>ajax4jsf</filter-name>
      <filter-class>org.ajax4jsf.Filter</filter-class>
      <init-param>
      <param-name>forceparser</param-name>
      <param-value>false</param-value>
      </init-param>


      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>

      <filter-mapping>
      <filter-name>ajax4jsf</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/rfRes/*</url-pattern>
      REQUEST
      FORWARD
      INCLUDE
      </filter-mapping>


      <servlet-name>FacesServlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>


      <servlet-mapping>
      <servlet-name>FacesServlet</servlet-name>
      <url-pattern>/xhtml/*</url-pattern>
      </servlet-mapping>

      <session-config>
      <session-timeout>10</session-timeout>
      </session-config>

      <welcome-file-list>
      <welcome-file>/xhtml/BillingSummary_view.jsf</welcome-file>
      </welcome-file-list>
      </web-app>

      Portal version is JBoss Portal 2.6.4
      JBoss 4.2.2.GA

      Obviously I am missing something, can anyone suggest what could be going wrong here?
      Thanks

        • 2. Re: JSF Portlet not rendering view - Jsf portletbridge bridg
          Wesley Hales Master

          btw, what's in your portlet.xml file in your current project?

          • 3. Re: JSF Portlet not rendering view - Jsf portletbridge bridg
            Sreeni Jakka Newbie

            Wesley
            Thanks for the response.
            I got the portletbridge working with my portlet now. One issue I am still facing is trying to work a4j in the portlet.
            I have a simple a4j:commandLink sets, I see the ajax call being made and logging from my backing bean. I see bunch of javascript code in the view source as well. but rerender is not working.
            I have added the <state-manager>
            org.jboss.portletbridge.application.PortalStateManager
            </state-manager>
            as well as per some older wiki entries.
            Does a4j work with the portal at this time or not? I am not able to find an answer from the previous posts.
            Thanks

            • 4. Re: JSF Portlet not rendering view - Jsf portletbridge bridg
              Sreeni Jakka Newbie

              Wesley
              I have a4j working now. I think it's a combination of preserveActionParams and RESOURCE_URI_PREFIX.
              Sreeni

              • 5. Re: JSF Portlet not rendering view - Jsf portletbridge bridg
                Santhosh Adari Newbie

                Hello All,

                I get the following error when I try to deploy th eexample from Spring webflow source.:

                2009-04-14 12:37:57,851 DEBUG [org.springframework.webflow.engine.impl.FlowExecutionImpl] Attempting to handle [org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'intro' of flow 'view'] with root cause [javax.faces.FacesException: No portlet bridge context]
                2009-04-14 12:37:57,851 DEBUG [org.springframework.webflow.engine.impl.FlowExecutionImpl] Rethrowing unhandled flow execution exception
                2009-04-14 12:37:57,851 DEBUG [org.springframework.web.portlet.DispatcherPortlet] Cleared thread-bound render request context: org.jboss.portal.portlet.impl.jsr168.api.RenderRequestImpl@eaf45a
                2009-04-14 12:37:57,851 ERROR [org.springframework.web.portlet.DispatcherPortlet] Could not complete request
                org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'intro' of flow 'view'
                at org.springframework.webflow.engine.impl.FlowExecutionImpl.wrap(FlowExecutionImpl.java:568)
                at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:226)
                at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(FlowExecutorImpl.java:133)
                at org.springframework.webflow.mvc.portlet.FlowHandlerAdapter.startFlow(FlowHandlerAdapter.java:236)
                at org.springframework.webflow.mvc.portlet.FlowHandlerAdapter.startFlow(FlowHandlerAdapter.java:229)
                at org.springframework.webflow.mvc.portlet.FlowHandlerAdapter.handleRender(FlowHandlerAdapter.java:131)
                at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:811)
                at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:483)
                at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:453)
                at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
                at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:568)
                at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:159)
                at org.jboss.portal.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:80)
                at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:505)
                at org.jboss.portal.portlet.container.ContainerPortletDispatcher.invoke(ContainerPortletDispatcher.java:42)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org$jboss$portal$core$aspects$portlet$TransactionInterceptor$invokeNotSupported$aop(TransactionInterceptor.java:97)
                at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N6922078035659651697.invokeNext(TransactionInterceptor$invokeNotSupported_N6922078035659651697.java)
                at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
                at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:112)
                at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N6922078035659651697.invokeNext(TransactionInterceptor$invokeNotSupported_N6922078035659651697.java)
                at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)
                at org.jboss.aspects.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:102)
                at org.jboss.portal.core.aspects.portlet.TransactionInterceptor$invokeNotSupported_N6922078035659651697.invokeNext(TransactionInterceptor$invokeNotSupported_N6922078035659651697.java)
                at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.invokeNotSupported(TransactionInterceptor.java)
                at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.invoke(TransactionInterceptor.java:58)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.core.aspects.portlet.HeaderInterceptor.invoke(HeaderInterceptor.java:49)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.EventPayloadInterceptor.invoke(EventPayloadInterceptor.java:196)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.RequestAttributeConversationInterceptor.invoke(RequestAttributeConversationInterceptor.java:119)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.core.aspects.portlet.SignOutInterceptor.invoke(SignOutInterceptor.java:43)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.core.aspects.portlet.AjaxInterceptor.invoke(AjaxInterceptor.java:49)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.core.aspects.portlet.BackwardCompatibilityInterceptor.invoke(BackwardCompatibilityInterceptor.java:46)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.bridge.BridgeInterceptor.invoke(BridgeInterceptor.java:49)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.PortletSessionSynchronizationInterceptor.invoke(PortletSessionSynchronizationInterceptor.java:82)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.ContextTrackerInterceptor.invoke(ContextTrackerInterceptor.java:48)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor.access$001(ContextDispatcherInterceptor.java:49)
                at org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor$1.doCallback(ContextDispatcherInterceptor.java:123)
                at org.jboss.portal.web.command.CommandDispatcher$CallbackCommand.execute(CommandDispatcher.java:74)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:585)
                at org.jboss.portal.web.command.CommandServlet.doGet(CommandServlet.java:130)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
                at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
                at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
                at org.jboss.portal.web.command.CommandServlet.include(CommandServlet.java:79)
                at org.jboss.portal.web.command.CommandDispatcher.include(CommandDispatcher.java:50)
                at org.jboss.portal.web.jboss.JBossWebContext.include(JBossWebContext.java:66)
                at org.jboss.portal.web.impl.DefaultServletContainer.include(DefaultServletContainer.java:190)
                at org.jboss.portal.portlet.impl.spi.AbstractServerContext.dispatch(AbstractServerContext.java:69)
                at org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor.invoke(ContextDispatcherInterceptor.java:77)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.SecureTransportInterceptor.invoke(SecureTransportInterceptor.java:69)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.aspects.portlet.ValveInterceptor.invoke(ValveInterceptor.java:75)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.container.ContainerPortletInvoker.invoke(ContainerPortletInvoker.java:116)
                at org.jboss.portal.portlet.PortletInvokerInterceptor.invoke(PortletInvokerInterceptor.java:82)
                at org.jboss.portal.portlet.state.producer.ProducerPortletInvoker.invoke(ProducerPortletInvoker.java:221)
                at org.jboss.portal.core.impl.portlet.state.ProducerPortletInvoker.org$jboss$portal$core$impl$portlet$state$ProducerPortletInvoker$invoke$aop(ProducerPortletInvoker.java:53)
                at

                web.xml looks like:

                <context-param>
                <param-name>contextConfigLocation</param-name>
                <param-value>
                /WEB-INF/config/application-config.xml
                </param-value>
                </context-param>
                <context-param>
                <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                <param-value>org.jboss.portletbridge.application.FaceletPortletViewHandler</param-value>
                </context-param>
                <context-param>
                <param-name>javax.portlet.faces.renderPolicy</param-name>
                <param-value>ALWAYS_DELEGATE</param-value>
                </context-param>
                <context-param>
                <param-name>javax.portlet.faces.BridgeImplClass</param-name>
                <param-value>javax.portlet.faces.GenericFacesPortlet</param-value>
                </context-param>

                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>




                portlet.xml looks:


                <portlet-name>swfp</portlet-name>
                <display-name>Spring Webflow Booking Faces</display-name>

                <portlet-class>
                org.springframework.web.portlet.DispatcherPortlet
                </portlet-class>

                <init-param>
                contextConfigLocation

                /WEB-INF/config/hotelbooking-portlet-config.xml

                </init-param>

                <init-param>
                viewRendererUrl
                /WEB-INF/servlet/view
                </init-param>

                <expiration-cache>0</expiration-cache>


                <mime-type>text/html</mime-type>
                <portlet-mode>view</portlet-mode>


                <portlet-info>
                Spring Webflow Booking Faces
                </portlet-info>





                faces-config:


                <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
                <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>


                <faces-context-factory>
                org.jboss.portletbridge.context.FacesContextFactoryImpl
                </faces-context-factory>



                and hotelbooking-portlet-config.xml looks:


                <?xml version="1.0" encoding="UTF-8"?>
                <beans xmlns="http://www.springframework.org/schema/beans"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:webflow="http://www.springframework.org/schema/webflow-config"
                xmlns:faces="http://www.springframework.org/schema/faces"
                xsi:schemaLocation="
                http://www.springframework.org/schema/beans
                http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                http://www.springframework.org/schema/webflow-config
                http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd
                http://www.springframework.org/schema/faces
                http://www.springframework.org/schema/faces/spring-faces-2.0.xsd">

                <!-- Maps portlet modes to handlers -->










                <!-- Maps logical view names selected by the url filename controller to .jsp view templates within the /WEB-INF directory -->





                <!-- Enables FlowHandlers -->




                <!-- Executes flows: the central entry point into the Spring Web Flow system -->
                <webflow:flow-executor id="flowExecutor">
                <webflow:flow-execution-listeners>
                <webflow:listener ref="jpaFlowExecutionListener" />
                </webflow:flow-execution-listeners>
                </webflow:flow-executor>

                <!-- The registry of executable flow definitions -->
                <webflow:flow-registry id="flowRegistry" flow-builder-services="facesFlowBuilderServices">
                <webflow:flow-location path="/WEB-INF/flows/view/view.xml" />
                <webflow:flow-location path="/WEB-INF/flows/main/main.xml" />
                <webflow:flow-location path="/WEB-INF/flows/booking/booking.xml" />
                </webflow:flow-registry>

                <!-- Configures the Spring Web Flow JSF integration -->
                <faces:flow-builder-services id="facesFlowBuilderServices" />

                <!-- Installs a listener that manages JPA persistence contexts for flows that require them -->

                <constructor-arg ref="entityManagerFactory" />
                <constructor-arg ref="transactionManager" />




                Any help would be appriciated.

                Thakn you,
                Santhosh






                • 6. Re: JSF Portlet not rendering view - Jsf portletbridge bridg
                  joodie B Newbie

                  Did you resolve your problem? I still have the same problem. I want to use spring web flow with richfaces in liferay and the same error!