Version 11

    These instructions detail how to replace JSF RI by MyFaces at JBoss AS level but you do NOT need to replace JSF RI by MyFaces for Portal to properly handle JSF portlets.

    This page replaces the original instructions on how to run Portal 2.6 on JBoss AS 4.2 and is just an update of the work originally done by Magesh Bojan.

     

    How to replace Sun RI implementation by MyFaces JSF implementation on JBoss AS 4.2.x

    JBoss AS 4.2.0.GA comes with Sun JavaServer Faces implementation version 1.2_04-b10-p01 integrated with JBossWeb. JBossWeb is our new Servlet/JSP container implementation.

     

    Remove the existing JSF implementation

    First you need to remove the bundled JSF implementation. To do so you need to comment/remove the following from the web.xml found under jboss-4.2.0.GA\server\<config-name>\deploy\jboss-web.deployer\conf.

     

       <!-- Comment/Remove this -->
       <!-- Configures JSF for a web application if the javax.faces.webapp.FacesServlet is declared -->
       <!-- in web.xml.                                                                             -->
       <!--
       <listener>
         <listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener</listener-class>
       </listener>
       -->
       <!-- Comment/Remove this -->
       <!-- Listens to all web app lifecycle events so that @PreDestroy can be called on -->
       <!-- JSF managed beans that go out of scope.  You can comment this out if you     -->
       <!-- don't use JSF or you don't use annotations on your managed beans.            -->
       <!--
       <listener>
         <listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>
       </listener>
       -->
    

     

    Install Apache MyFaces JSF implementation

    Use Apache MyFaces version that comes bundled with JBoss AS 4.0.4.x or JBoss AS 4.0.5.x. Delete jboss-4.2.0.GA\server\<config-name>\deploy\jboss-web.deployer\jsf-libs. Create jboss-4.2.0.GA\server\<config-name>\deploy\jboss-web.deployer\myfaces-libs and copy the following libraries into the myfaces-lib directory. For Portal 2.6.3 use the files found under jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\lib2.

     

       commons-beanutils.jar
       commons-digester-1.6.jar
       commons-el.jar
       commons-lang-2.1.jar
       myfaces-api.jar
       myfaces-impl.jar
    

     

    Modify the web.xml found under jboss-4.2.0.GA\server\<config-name>\deploy\jboss-web.deployer\conf to add the listener as follows:

     

      <listener>
        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      </listener>
    

    -


    For 4.2.2 and beyond

     

    Replace the following from the web.xml found under jboss-4.2.2.GA\server\<config-name>\deploy\jboss-web.deployer\conf.

     

       <init-param> 
         <description>JSF standard tlds</description> 
         <param-name>tagLibJar0</param-name> 
         <param-value>jsf-libs/jsf-impl.jar</param-value> 
       </init-param> 
       <init-param> 
         <description>JSTL standard tlds</description> 
         <param-name>tagLibJar1</param-name> 
         <param-value>jstl.jar</param-value> 
       </init-param>
    

     

    with

     

       <init-param> 
         <description>MyFaces tlds</description> 
         <param-name>tagLibJar0</param-name> 
         <param-value>myfaces-libs/myfaces-impl.jar</param-value> 
       </init-param>
    

     

    For JBossPortal 2.6.3 + JBoss4.2.2.GA

     

    After following the steps abive these three wars may not deploy: portal-admin.war, portal-identity.war, portal-wsrp-admin.war. To make these work under the global MyFaces library do the following

     

    • Copy the following jars from jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\lib2 to jboss-portal.sar\portal-admin.sar\lib

     

       el-api.jar, el-ri.jar, jsf-example.jar, jsf-facelets.jar, portal-core-admin-lib.jar, portal-faces-lib.jar

     

    • Copy the following jars from jboss-portal.sar\portal-identity.sar\portal-identity.war\WEB-INF\lib2 to jboss-portal.sar\portal-identity.sar\lib

     

       el-api.jar, el-ri.jar, jsf-example.jar, jsf-facelets.jar, portal-core-identity-services-lib.jar, portal-core-identity-ui-lib.jar, portal-faces-lib.jar

     

    • Copy the following jars from jboss-portal.sar\portal-wsrp.sar\portal-wsrp-admin.war\WEB-INF\lib2 to jboss-portal.sar\portal-wsrp.sar\lib

     

       el-api.jar, el-ri.jar, jsf-example.jar, jsf-facelets.jar, portal-wsrp-admin-lib.jar, portal-faces-lib.jar

     

    • Modify the jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\web.xml, jboss-portal.sar\portal-identity.sar\portal-identity.war\WEB-INF\web.xml, jboss-portal.sar\portal-wsrp.sar\portal-wsrp-admin.war\WEB-INF\web.xml and replace this

        <servlet>
           <servlet-name>Faces Servlet</servlet-name>
           <servlet-class>org.jboss.portal.faces.loader.FacesLoaderServlet</servlet-class>
           <load-on-startup>1</load-on-startup>
        </servlet>
    

     

         with

     

        <servlet>
           <servlet-name>Faces Servlet</servlet-name>
           <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
           <load-on-startup>1</load-on-startup>
        </servlet>
    
    • Modify the jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\portlet.xml, jboss-portal.sar\portal-identity.sar\portal-identity.war\WEB-INF\portlet.xml, jboss-portal.sar\portal-wsrp.sar\portal-wsrp-admin.war\WEB-INF\portlet.xml and replace all occurrence of this

         <portlet-class>org.jboss.portal.faces.loader.FacesPortlet</portlet-class>
    

     

         with

     

         <portlet-class>org.apache.myfaces.portlet.MyFacesGenericPortlet</portlet-class>
    
    • Finally you can remove these directories jboss-portal.sar\portal-admin.sar\portal-admin.war\WEB-INF\lib2, jboss-portal.sar\portal-identity.sar\portal-identity.war\WEB-INF\lib2, jboss-portal.sar\portal-wsrp.sar\portal-wsrp-admin.war\WEB-INF\lib2 and the portal-faces-loader-lib.jar file found under jboss-portal.sar\portal-admin.sar\lib, jboss-portal.sar\portal-identity.sar\lib, jboss-portal.sar\portal-wsrp.sar\portal-wsrp-admin.war\WEB-INF\lib for reducing deployment size.

     

    Note: You can also place these jars el-api.jar, el-ri.jar, jsf-example.jar, jsf-facelets.jar under jboss-4.2.2.GA\server\<config-name>\deploy\jboss-web.deployer\myfaces-libs and remove them from the individual directories of sars.

     

    Referenced by: