1 Reply Latest reply on Jan 30, 2011 2:12 AM by Sergey Zubarev

    Gatein + Porlet bridge + richfaces ajax tree

    Sergey Zubarev Newbie

      I'm try to use richfaces in gatein.

       

      Gatein v.3.1

      Portlet bridge v.2.1

      richfaces 3.3.3.final

       

       

      When i use tree switchType = "server" - all ok. But when I set it to "ajax" exception occured when I try to expand tree (first level displayed well):

       

       

      25.01.2011 13:17:20 org.exoplatform.portal.webui.application.UIPortletActionListener$ServeResourceActionListener execute
      SEVERE: Problem while serving resource for the portlet: local._dumbvalue
      javax.portlet.PortletException: Error process faces request
          at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:543)
          at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl$Invoker.doFilter(PortletContainerImpl.java:575)
          at org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:184)
          at org.gatein.pc.portlet.impl.jsr168.api.FilterChainImpl.doFilter(FilterChainImpl.java:84)
          at org.gatein.pc.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:506)
          at org.gatein.pc.portlet.container.ContainerPortletDispatcher.invoke(ContainerPortletDispatcher.java:42)
       *********************** 
      
      Caused by: javax.portlet.faces.BridgeException: java.lang.NullPointerException
          at org.jboss.portletbridge.richfaces.RichFacesStrategy.finishResponse(RichFacesStrategy.java:179)
          at org.jboss.portletbridge.richfaces.RichFacesStrategy.afterResourceRequest(RichFacesStrategy.java:267)
          at org.jboss.portletbridge.BridgeStrategyWrapper.afterResourceRequest(BridgeStrategyWrapper.java:133)
          at org.jboss.portletbridge.AjaxPortletBridge.doFacesRequest(AjaxPortletBridge.java:840)
          at javax.portlet.faces.GenericFacesPortlet.serveResource(GenericFacesPortlet.java:541)
          ... 100 more
      Caused by: java.lang.NullPointerException
          at org.ajax4jsf.context.ViewResources.processHeadResources(ViewResources.java:401)
          at org.jboss.portletbridge.richfaces.RichFacesStrategy.finishResponse(RichFacesStrategy.java:162)
          ... 104 more
      

       

       

       

       

      faces-config.xml:

       

      <faces-config 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-facesconfig_1_2.xsd"
                    version="1.2">
      
      
      
          <application>
            <view-handler>org.jboss.portletbridge.application.PortletViewHandler</view-handler>
            <state-manager>org.jboss.portletbridge.application.PortletStateManager</state-manager>
         </application>
      
      
         <managed-bean>
            <managed-bean-name>phoneBook</managed-bean-name>
            <managed-bean-class>
               ru.tersys.projects.gatein.common.phoneBook.jsf.PhoneBookBean
            </managed-bean-class>
            <managed-bean-scope>application</managed-bean-scope>
         </managed-bean>
      
      </faces-config>
      

       

       

      web.xml:

       

      <?xml version="1.0"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
               version="2.5">
      
        <display-name>
            TERSYS PORTLETS
        </display-name>
      
        <filter>
          <filter-name>ResourceRequestFilter</filter-name>
          <filter-class>org.exoplatform.portal.application.ResourceRequestFilter</filter-class>
        </filter>
      
        <filter-mapping>
          <filter-name>ResourceRequestFilter</filter-name>
          <url-pattern>/*</url-pattern>
        </filter-mapping>
      
        <context-param>
            <param-name>javax.portlet.faces.renderPolicy</param-name>
            <param-value>ALWAYS_DELEGATE</param-value>
         </context-param>
         <context-param>
            <param-name>org.ajax4jsf.RESOURCE_URI_PREFIX</param-name>
            <param-value>rfRes</param-value>
         </context-param>
         <context-param>
            <param-name>org.richfaces.LoadStyleStrategy</param-name>
            <param-value>ALL</param-value>
         </context-param>
         <context-param>
            <param-name>org.richfaces.LoadScriptStrategy</param-name>
            <param-value>ALL</param-value>
         </context-param>
         <context-param>
            <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
            <param-value>false</param-value>
         </context-param>
      
          <filter>
             <display-name>Ajax4jsf Filter</display-name>
             <filter-name>ajax4jsf</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
          </filter>
         <filter-mapping>
            <filter-name>ajax4jsf</filter-name>
            <servlet-name>Faces Servlet</servlet-name>
            <dispatcher>FORWARD</dispatcher>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>INCLUDE</dispatcher>
         </filter-mapping>
         <context-param>
            <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
            <param-value>.xhtml</param-value>
         </context-param>
         <context-param>
            <param-name>facelets.DEVELOPMENT</param-name>
            <param-value>false</param-value>
         </context-param>
         <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
         </servlet>
         <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
         </servlet-mapping>
         <session-config>
            <session-timeout>10</session-timeout>
         </session-config>   
      
      </web-app>
      

       

      portlet.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
      version="2.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
         http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
      
          <portlet>
            <portlet-name>TersysPhoneBookTreePortlet</portlet-name>
            <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
            <supports>
               <mime-type>text/html</mime-type>
               <portlet-mode>view</portlet-mode>
            </supports>
            <portlet-info>
               <title>PhoneBook Tree Portlet</title>
            </portlet-info>
      
            <init-param>
               <name>javax.portlet.faces.defaultViewId.view</name>
               <value>/jsp/PhoneBook/tree.jsp</value>
            </init-param>
      
          </portlet>
      
      
      </portlet-app>
      

       

      tree.jsp:

       

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
      
      <f:view>
      
      <h:form>
       <rich:panel>
      
              <rich:tree style="width:300px" switchType="ajax">
                  <rich:recursiveTreeNodesAdaptor roots="#{phoneBook.sourceRoots}" var="item" nodes="#{item.nodes}" />
              </rich:tree>
      
      
       </rich:panel>
      </h:form>
      
      </f:view>
      

       

       

      Plz help to solve this issue!