Using MyFaces with external and optional Modules

Using Tomahawk without an Internet connection (and with the Sun RI)

The tomahawk.jar file contains META-INF/faces-config.xml with a PUBLIC reference to web-facesconfig_1_1.dtd. This causes the DTD to be referenced from java.sun.com during application server startup (tested on Apache Tomcat 5.x but may apply to other servers as well). This problem manifests itself as follows (in this case, taken from the Apache Tomcat log file):

"javax.faces.FacesException: Can't parse configuration file:jar:file:/<web-context-path>/WEB-INF/lib/tomahawk.jar!/META-INF/faces-config.xml"

A work-around for this problem is as follows:

     <!DOCTYPE faces-config SYSTEM "web-facesconfig_1_1.dtd">

MyFaces with Sun JSF RI

Facelet support for tomahawk

Using MyFaces in Servlet Containers

JBoss

See http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossFaces

Websphere

See Websphere_Installation

Orion 2.0.2

See Make_it_work_with_Orion_application_server

SunOne 7

java.io.FilePermission "<<ALL FILES>>", "read,write";

java.io.FilePermission "<<ALL FILES>>", "read,write,delete";

SunOne 8.1

java.io.FilePermission "<<ALL FILES>>", "read,write";

java.io.FilePermission "<<ALL FILES>>", "read,write,delete";

<?xml version="1.0" encoding="UTF-8"?>

<sun-web-app>

</sun-web-app>

That way, myfaces classes will be loaded instead of Sun RI ones.

By creating in your webapp a "fake" com.sun.faces.config.ConfigureListener that will be loaded BEFORE the sun RI one's.

Like that:

package com.sun.faces.config;

import javax.servlet.*;

/**

public class ConfigureListener implements ServletContextListener {

}

Apache Tomcat 4.x and 5.0.x

Apache Tomcat 4.x and 5.0.x should work with the MyFaces example war files.

All necessary library-files should be included in the war-file - except:

You can download these files from

Apache Tomcat 5.5.x (except 5.5.9)

Apache Tomcat 5.5.x should work out of the box, all needed jars are supplied by the given MyFaces war files.

If you see a blank page on startup - the files jsp-2.0.jar and commons.el must be deleted, since Tomcat 5.5.x delivers those files out of the box and a library conflict is caused with the one given by the MyFaces war.

If you want to write your own tags you need the jsp-api-2.0.jar file in your compile classpath. If you use Maven2 you can exclude the jsp-api-2.0.jar from the war file by define a dependency like this:

 <dependency>
     <groupId>javax.servlet</groupId>
     <artifactId>jsp-api</artifactId>
     <version>2.0</version>
     <scope>provided</scope>
 </dependency>

The scope provided tells maven to exclude the jar file while packaging.

Apache Tomcat 5.5.9

Apache Tomcat 5.5.9 is somewhat special, due to some configuration problems in exactly this version (both lower and higher should be ok, and don't need this extra step).

BEA WebLogic 8.1

Add jsp-2.0.jar and servlet-api.jar (can be found in Tomcat 5.5.x share/lib) to classpath of server startup script (startWebLogic.sh/cmd) of WebLogic or include them in your war WEB-INF/lib

servlet-api.jar is required if your server has no internet connection. The reason is when MyFaces lib parse web.xml file, it assumes that web-app_2_3.dtd is accessible locally as javax/servlet/web-app_2_3.dtd or directly on http://java.sun.com/dtd/web-app_2_3.dtd. WebLogic has not javax/servlet/web-app_2_3.dtd in it's lib

Steps for getting Facelets working with MyFaces on WebLogic:

Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)

In order to deploy the simple.war from MyFaces 1.1.1 the following step were needed:

1. oc4j-config 1.1. application.xml

1.2. http-web-site.xml

2. unpack the simple.war to home/applications/simple 3. webapp-changes

4. start oc4j

So far only the link to "Sample 1" fails with a 500 ... to be investigated.

Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)

permlink

In order to deploy my MyFaces (post-1.1.1 nightlies) and facelets (1.0) applications from the following step were needed:

  1. Create an OC4J instance.
  2. Log into the application server, and edit the .../j2ee/YOUROC4JINSTANCE/config/application.xml file for the instance to contain
    • <library path="../../../jlib/jsp-el-api.jar"/>

    • <library path="../../../jlib/commons-el.jar"/>

  3. execute /ora/{...}/{...}/dcm/bin/dcmctl updateconfig -v -d
  4. Deploy your application.ear

Note that to get facelets working, you must manually extract all facelets taglib.xml files from all facelet-enabled jar files (There are six taglib files in the jsf-facelets jar) and manually specify them from your web.xml file. Supposedly, this is not an issue for 10.1.3. Here's an example:

<context-param>
    <param-name>facelets.LIBRARIES</param-name>
    <param-value>/WEB-INF/oc4j-hacks/jsf-core.taglib.xml;/WEB-INF/oc4j-hacks/jsf-html.taglib.xml;/WEB-INF/oc4j-hacks/jsf-ui.taglib.xml;/WEB-INF/oc4j-hacks/jstl-core.taglib.xml;/WEB-INF/oc4j-hacks/jstl-fn.taglib.xml</param-value>
    <description>A semicolon (;) delimitted list of paths to Facelet tag libraries</description>
</context-param>

Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)

In order to deploy the simple.war from MyFaces 1.1.1 the following step were needed:

1. oc4j-config 1.1. application.xml

1.2. http-web-site.xml

2. unpack the simple.war to home/applications/simple 3. webapp-changes

4. start oc4j

So far only the link to "Sample 1" and "Sample 2" fails with a 500 ... to be investigated.

Oracle Application Server Containers for J2EE 10g (10.1.3.1.0)

permlink

In order to deploy my MyFaces core 1.1.4, a Tomahawk 1.1.5 nightly from 2006-08-18, and facelets 1.1.11 applications from the following step were needed:

  1. Create an OC4J instance.
  2. Deploy your application.ear
  3. In Deployment step 3, edit deployment plan.
  4. Choose "Edit Libraries"
  5. Set path to "../../../../jlib/commons-el.jar"
  6. Complete deployment. Note that you can save the deployment plan at this point and upload it with your ear file for future application deployments.

Other Containers

     [...]
 </filter-mapping>

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

 <servlet>
     [...]

For Jetty 5.1.3rc0 and later, you need to uncomment the TagLibConfiguration in the jetty.xml file to enable registering listeners in tld files, or you can respecify it like this:

  <Set name="WebApplicationConfigurationClassNames">
    <Array type="java.lang.String">
      <Item>org.mortbay.jetty.servlet.TagLibConfiguration</Item>
    </Array>
  </Set>

This option is enabled by default in Jetty 6.

Installation_and_Configuration (last edited 2011-08-05 13:48:00 by StephenKenna)