5 Replies Latest reply on Jan 9, 2008 7:47 AM by kennychaffin

    Myface  problem on jboss portlet

    jackyluck

      I try to adopt Myfaces work on jboss portlet ,but it aways have error on the wep page when i open the portlet,the error is :

      Cause: java.lang.NullPointerException
      StackTrace:
      java.lang.NullPointerException
      at org.apache.myfaces.application.DefaultViewHandlerSupport.calculateServletMapping(DefaultViewHandlerSupport.java:123)
      at org.apache.myfaces.application.DefaultViewHandlerSupport.calculateViewId(DefaultViewHandlerSupport.java:44)
      at org.apache.myfaces.application.jsp.JspViewHandlerImpl.createView(JspViewHandlerImpl.java:140)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.nonFacesRequest(MyFacesGenericPortlet.java:320)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.nonFacesRequest(MyFacesGenericPortlet.java:298)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.facesRender(MyFacesGenericPortlet.java:380)
      at org.apache.myfaces.portlet.MyFacesGenericPortlet.doView(MyFacesGenericPortlet.java:266)
      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)
      at org.jboss.portal.common.invocation.Invocation.invokeNext(Invocation.java:131)
      at org.jboss.portal.core.aspects.portlet.TransactionInterceptor.org$jboss$portal$core$aspects$portlet$TransactionInterceptor$invokeNotSupported$aop(TransactionInterceptor.java:86)
      ............

      below is my config:
      1.I have add
      commons-beanutils-1.7.0.jar
      commons-codec-1.3.jar
      commons-collections-3.2.jar
      commons-digester-1.8.jar
      commons-discovery-0.4.jar
      commons-logging-1.1.jar
      myfaces-api-1.2.0.jar
      myfaces-impl-1.2.0.jar

      2.my portlet.xml :
      ......
      <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
      <init-param>
      default-view
      /welcomeJSF.jsp
      </init-param>

      3.my web.xml is :
      <context-param>
      <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
      <param-value>true</param-value>
      </context-param>

      <context-param>
      <param-name>com.sun.faces.verifyObjects</param-name>
      <param-value>false</param-value>
      </context-param>

      <context-param>
      <param-name>com.sun.faces.validateXml</param-name>
      <param-value>true</param-value>
      </context-param>

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



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


      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/faces/*</url-pattern>
      </servlet-mapping>

      <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>


      Now I dont't know how to do can let myfaces work on portlet

        • 1. Re: Myface  problem on jboss portlet
          aamonten

          Hi, you are not specifying what version of AS and Portal you are using, so it can be a little difficult to give you a right answer. But I am supposing that you are using the latest version.

          Well at the wiki they have documented how to use MyFaces, take a look at http://wiki.jboss.org/wiki/Wiki.jsp?page=JBoss5AndMyFaces. An interesting observation is that on the wiki they say:

          There is no technical reason to use MyFaces Core on JBoss 4.2 or JBoss 5.x.


          Regards
          Alejandro

          • 2. Re: Myface  problem on jboss portlet
            kennychaffin

            Interesting, thanks. I tried that and at least in my application I am still getting faces errors:

            10:56:00,173 ERROR [STDERR] Caused by: javax.portlet.PortletException: Class org.apache.myfaces.portlet.MyFacesGenericPortlet is not found.

            Any thoughts on that?

            Thanks,
            KAC

            • 3. Re: Myface  problem on jboss portlet
              symmetrysolutions

              I believe that error is coming from a declaration in your portlet.xml (at least it is in mine) that is used as a filter for support of tomahawk components. If you do not use tomahawk then you can probably remove it.

              I believe it is an init param of the porlet bridges project from Apache.

              Jim

              • 4. Re: Myface  problem on jboss portlet
                symmetrysolutions

                I mis-spoke in the first response. MyFacesGeneric portlet is an implementation of javax.faces.GenericPortlet and converts portlet requests into JSF requests. Obviously this class is important if there is no equivalent implementation in JSF RI.

                I am have the same issue and will see if I can resolve it without loading MyFaces instead of JSF RI.

                Jim

                • 5. Re: Myface  problem on jboss portlet
                  kennychaffin

                  Just to follow up. I did get my portlet app working by using the apache myfaces faces-api and faces-impl and adding the "include faces in project" tag to the web.xml.

                  KAC