Monday, April 09, 2007

Getting Tomcat 6 and JSF 1.2 Working

posted by John Blanco @ 1:02 PM

 

I've spent a lot of time trying to get a stable Tomcat/JSF 1.2 environment running. In some cases, even if it looks like it works, the ELResolver is broken and you will figure that out eventually. :-)

The first thing JSF vets will need to note is that the JSF 1.2 RI libraries indeed DO NOT NEED the Apache commons libaries all your books tell you it needs. Indeed, this was true of JSF 1.1. Not JSF 1.2. The library has been folded in to the JSF 1.2 IMPL library, so rest assured. (As it pertains to the Sun RI version anyway -- download them here)

Another common error is:

"javax.servlet.ServletException: javax/servlet/jsp/tagext/JspIdConsumer"

This suggests you are having JSP issues in Tomcat 5 -- a result of JSF 1.2 requiring JSP 2.1 support -- bad news. It won't work. So far, only GlassFish and Tomcat 6 will work for you (see below). However, you have one useful option: use Facelets. If you don't need JSP, you won't hit the JSP 2.1 requirement.

Next, if you are indeed having ELResolver issues in Tomcat 6 -- a result of the move to Unified EL in JSF 1.2 -- there is a simple fix to this. Open up your tomcat/conf/web.xml file and add the following within the <web-app&rt; tags.


<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>org.apache.el.ExpressionFactoryImpl</param-value>
</context-param>


Your installation should be working now. Now, all you need to do is install your web app. Keep in mind that the only libraries you should need to provide with it are:


  • jsf-api.jar
  • jsf-impl.jar
  • jstl.jar
  • standard.jar


When compiling, you will also need to add one other file to your classpath (but do not package it as it's already included in Tomcat):


  • tomcat/lib/el-api.jar

0 Comments:

Post a Comment

<< Home