6 Replies Latest reply on Jan 10, 2008 12:46 PM by Jing Fu

    richfaces portlet bridge 3.1.2.GA - NullPointerException

    Marcus Schumacher Newbie

      hello,
      when I upgrade from richfaces-3.1.1.GA to richfaces-3.1.2.GA the according portlet bridge doesn't work.
      I get a NullPointer-Exception - so I must go back on bridge-3.1.1.GA.
      Is there a changed configuration necessary?
      I use:
      faces.config:

      <application>
      <view-handler>org.ajax4jsf.portlet.application.PortletViewHandler</view-handler>
      <state-manager>org.ajax4jsf.portlet.application.PortalStateManager</state-manager>
      <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
      </application>
      
      <factory>
      <faces-context-factory>org.ajax4jsf.portlet.context.FacesContextFactoryImpl</faces-context-factory>
      </factory>
      
      <managed-bean>
      <managed-bean-name>ajaxContext</managed-bean-name>
      <managed-bean-class>org.ajax4jsf.portlet.PortletAjaxContext</managed-bean-class>
      <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
      
      <render-kit>
      <renderer>
      <description>override the viewroot</description>
      <component-family>javax.faces.ViewRoot</component-family>
      <renderer-type>javax.faces.ViewRoot</renderer-type>
      <renderer-class>
      org.ajax4jsf.portlet.renderkit.portlet.PortletAjaxViewRootRenderer
      </renderer-class>
      </renderer>
      </render-kit>
      
      

      this is the Exception:

      javax.portlet.PortletException: Error processing execute lifecycle
       at org.ajax4jsf.portlet.AjaxFacesPortlet.doView(AjaxFacesPortlet.java:191)
       at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
       at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:405)
       at org.jboss.portal.portlet.container.PortletContainerInvoker$1.invoke(PortletContainerInvoker.java:86)
       ............
      javax.faces.FacesException: java.lang.NullPointerException
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:306)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at org.ajax4jsf.portlet.AjaxFacesPortlet.render(AjaxFacesPortlet.java:256)
       at org.ajax4jsf.portlet.AjaxFacesPortlet.doView(AjaxFacesPortlet.java:175)
       at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
       at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:405)
       at org.jboss.portal.portlet.container.PortletContainerInvoker$1.invoke(PortletContainerInvoker.java:86).....
      
      .......................
      java.lang.NullPointerException
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:526)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:243)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:243)
       at org.ajax4jsf.portlet.application.PortletViewHandler.renderView(PortletViewHandler.java:48)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at org.ajax4jsf.portlet.AjaxFacesPortlet.render(AjaxFacesPortlet.java:256)
       at org.ajax4jsf.portlet.AjaxFacesPortlet.doView(AjaxFacesPortlet.java:175)
       at javax.portlet.GenericPortlet.doDispatch(GenericPortlet.java:133)
       at javax.portlet.GenericPortlet.render(GenericPortlet.java:306)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.invokeRender(PortletContainerImpl.java:483)
       at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.dispatch(PortletContainerImpl.java:405)
       at org.jboss.portal.portlet.container.PortletContainerInvoker$1.invoke(PortletContainerInvoker.java:86)
      
      


      When I use the SNAPSHOT-Releases of richfaces and the portlet-bridge I get the same errors.

      I use JBoss AS 4.2.1 with JSF-1.2 RI , Portal-2.6.2 and Facelets-Technology.

      What can I do?
      Is it possible to use richfaces + jsf-1.2RI and Portal-2.6.2 with JSP-technology instead of facelets-technology?

      Thanks!

      Marcus21



        • 1. Re: richfaces portlet bridge 3.1.2.GA - NullPointerException
          JP Barbe Newbie

          Hi Marcus,
          I'm sorry, I have not a solution for you, but maybe you can help me.
          I try to deploy my app with richfaces-3.1.1 GA on JBoss Portal 2.6 GA.
          It seems you did it successfully.
          My faces.config is almost the same than yours (I don't use Spring)
          Can you show me your web.xml ?

          Thanks for your help.
          JP

          • 2. Re: richfaces portlet bridge 3.1.2.GA - NullPointerException
            Marcus Schumacher Newbie

            Hi,

            here is my web.xml:

            <?xml version="1.0"?>
            <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">
            
             <display-name>Koelsch Portlets</display-name>
             <description>Koelsch Portlets</description>
             <!-- JSF configuration -->
             <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>server</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
             <param-value>.xhtml</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.application.CONFIG_FILES</param-name>
             <param-value>/WEB-INF/faces-config.xml</param-value>
             </context-param>
            
             <!-- Facelet configuration -->
             <context-param>
             <param-name>facelets.DEVELOPMENT</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <param-name>facelets.SKIP_COMMENTS</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <param-name>facelets.VIEW_MAPPINGS</param-name>
             <param-value>*.xhtml</param-value>
             </context-param>
            
             <!-- needed for portlet environment -->
             <context-param>
             <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
             <param-value>org.ajax4jsf.portlet.application.FaceletPortletViewHandler</param-value>
             </context-param>
             <context-param>
             <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
             <param-value>false</param-value>
             </context-param>
            
             <!-- Spring Config -->
             <context-param>
             <param-name>webAppRootKey</param-name>
             <param-value>koelsch.root</param-value>
             </context-param>
             <context-param>
             <param-name>log4jConfigLocation</param-name>
             <param-value>/WEB-INF/koelsch-log4j.properties</param-value>
             </context-param>
             <context-param>
             <param-name>contextConfigLocation</param-name>
             <param-value>/WEB-INF/applicationContext.xml</param-value>
             </context-param>
            
             <!-- RichFaces and ajax4jsf settings -->
             <context-param>
             <param-name>org.ajax4jsf.SKIN</param-name>
             <param-value>DEFAULT</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>REQUEST</dispatcher>
             <dispatcher>FORWARD</dispatcher>
             <dispatcher>INCLUDE</dispatcher>
             </filter-mapping>
            
             <!--
             <listener>
             <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
             </listener>
             -->
             <listener>
             <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
             </listener>
            
             <!-- Faces Servlet -->
             <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>1</load-on-startup>
             </servlet>
             <!-- extension mapping -->
             <servlet-mapping>
             <servlet-name>Faces Servlet</servlet-name>
             <url-pattern>/faces/*</url-pattern>
             </servlet-mapping>
            
            </web-app>
            


            OK, but not all richfaces components work.
            It works:
            - <rich:dataGrid />
            - <rich:dataTable />
            - <rich:datascroller />

            I think the portlet-bridge actually has problems with the scope of components, for example the jsf-managed-beans.

            marcus21


            • 3. Re: richfaces portlet bridge 3.1.2.GA - NullPointerException
              Dimiter Atanasov Newbie

              I am trying to deploy a richfaces portlet not using Facelets - with no success -
              http://jboss.com/index.html?module=bb&op=viewtopic&t=115083&postdays=0&postorder=asc&start=10

              Does anyone succeded doing this?

              • 4. Re: richfaces portlet bridge 3.1.2.GA - NullPointerException
                Vecchio Fabrizio Newbie

                Hi Marcus,
                i'm in the same trouble, i tried also 3.1.3.CR3 without success.
                I used pluto as portlet container and pit 3.1.0 i have no problem.
                You have any news ?

                • 5. Re: richfaces portlet bridge 3.1.2.GA - NullPointerException
                  Marcus Schumacher Newbie

                  Hi,

                  the new Richfaces version 3.1.3 now works in Portal 2.6.3 and JBoss-4.2.x!
                  use the following libs:

                  richfaces-api-3.1.3.GA.jar
                  richfaces-impl-3.1.3.GA.jar
                  richfaces-ui-3.1.3.GA.jar
                  
                  and use the bridge from Maven-Repo:
                  http://repository.jboss.com/maven2/org/richfaces/extensions/portletbridge/portletbridge-api/3.1.3.GA/
                  and
                  http://repository.jboss.com/maven2/org/richfaces/extensions/portletbridge/portletbridge-impl/3.1.3.GA/
                  
                  portletbridge-api-3.1.3.GA.jar
                  portletbridge-impl-3.1.3.GA.jar
                  

                  I use facelets-technology so my web.xml looks like:
                  <?xml version="1.0"?>
                  <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">
                  
                   <display-name>Koelsch Portlets</display-name>
                   <description>Koelsch Portlets</description>
                  
                   <!-- JSF configuration -->
                   <context-param>
                   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                   <param-value>server</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                   <param-value>.xhtml</param-value>
                   </context-param>
                  
                  
                   <context-param>
                   <param-name>javax.faces.application.CONFIG_FILES</param-name>
                   <param-value>/WEB-INF/faces-config.xml</param-value>
                   </context-param>
                  
                   <!-- Facelet configuration -->
                  
                   <context-param>
                   <param-name>facelets.DEVELOPMENT</param-name>
                   <param-value>true</param-value>
                   </context-param>
                   <context-param>
                   <param-name>facelets.SKIP_COMMENTS</param-name>
                   <param-value>true</param-value>
                   </context-param>
                   <context-param>
                   <param-name>facelets.VIEW_MAPPINGS</param-name>
                   <param-value>*.xhtml</param-value>
                   </context-param>
                  
                  
                   <!-- needed for portlet environment -->
                  
                   <context-param>
                   <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                   <param-value>org.ajax4jsf.portlet.application.FaceletPortletViewHandler</param-value>
                   </context-param>
                  
                   <context-param>
                   <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
                   <param-value>false</param-value>
                   </context-param>
                  
                  
                   <!-- RichFaces and ajax4jsf settings -->
                  
                   <context-param>
                   <param-name>org.ajax4jsf.SKIN</param-name>
                   <param-value>DEFAULT</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>REQUEST</dispatcher>
                   <dispatcher>FORWARD</dispatcher>
                   <dispatcher>INCLUDE</dispatcher>
                   </filter-mapping>
                  
                  
                  
                   <!-- Faces Servlet -->
                   <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                   </servlet>
                   <!-- extension mapping -->
                   <servlet-mapping>
                   <servlet-name>Faces Servlet</servlet-name>
                   <url-pattern>/faces/*</url-pattern>
                   </servlet-mapping>
                  
                  </web-app>
                  
                  

                  the faces-config.xml looks like:
                  <?xml version="1.0" encoding="UTF-8"?>
                  <faces-config version="1.2" 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">
                  
                  
                  <application>
                   <message-bundle>koelsch-messages</message-bundle>
                  
                  <view-handler>org.ajax4jsf.portlet.application.PortletViewHandler</view-handler>
                  <state-anager>org.ajax4jsf.portlet.application.PortalStateManager</state-manager>
                  </application>
                  
                  <factory>
                  <faces-context-factory>
                  org.ajax4jsf.portlet.context.FacesContextFactoryImpl
                  </faces-context-factory>
                  </factory>
                  
                   <managed-bean>
                  .......
                   </managed-bean>
                  
                  </faces-config>
                  


                  and important are the new keyword in portlet.xml:
                  <portlet>
                   <description>KoelschGuestbookPortlet</description>
                   <portlet-name>KoelschGuestbookPortlet</portlet-name>
                   <display-name>KoelschGuestbookPortlet</display-name>
                  <portlet-class>javax.portlet.faces.GenericFacesPortlet</portlet-class>
                   <init-param>
                   <name>javax.portlet.faces.defaultViewId.view</name>
                   <value>/view/guestbook.xhtml</value>
                   </init-param>
                   <expiration-cache>0</expiration-cache>
                   <supports>
                   <mime-type>text/html</mime-type>
                   <portlet-mode>VIEW</portlet-mode>
                   </supports>
                   <portlet-info>
                   <title>Gaestebuch</title>
                   </portlet-info>
                   </portlet>
                  


                  You can also see the ajax4jsf-portlet-sample in the Sources of richfaces-3.1.3-GA.

                  Marcus

                  • 6. Re: richfaces portlet bridge 3.1.2.GA - NullPointerException
                    Jing Fu Newbie

                    Marcus, did the new portlet bridge(3.1.3) resolve the JSF bean scope issue for you?

                    I also used to use AjaxFacesPortlet directly, and put "org.ajax4jsf.portlet.PortletAjaxContext" in the "faces-config.xml", but it has issues with JSF managed bean session scope whenver I use Ajax4JSF. Does this issue sound familiar?

                    I spent quiet a bit time to use this new bridge, but facelets CompositionComponents aren't displayed anymore. No error, it just shows nothing in the portlet. My portal is liferay 43. I downloaded the portlet bridge from the link from your posted above. Also I did follow all the instructions about the config file tweaks. Does this ever ring a bell to you?

                    Any pointer will be greatly appreciated!!