5

I am getting the following exception in my application.

com.sun.faces.config.ConfigurationException: It appears the JSP version of the container is older than 2.1 and unable to locate the EL RI expression factory, com.sun.el.ExpressionFactoryImpl. If not using JSP or the EL RI, make sure the context initialization parameter, com.sun.faces.expressionFactory, is properly set.

How to set the EL details in the web.xml.

Krishna
  • 7,154
  • 16
  • 68
  • 80

4 Answers4

8

The exception is telling that JSP 2.1 is required. You need to ensure that your web.xml is declared as Servlet 2.5 or newer, and that your servletcontainer supports it (Tomcat 6, Glassfish 2, JBoss AS 5, etc, or newer). JSP 2.1 goes hand in hand with Servlet 2.5. A proper Servlet 2.5 declared web.xml starts as follows:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 
    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"
    version="2.5">

    <!-- Config here. -->

</web-app>

If you're using an older versioned servletcontainer which you can really not upgrade to at least a Servlet 2.5 compatible one, then you need to let us know first which one it is so that we can if possibly post more suited answers/workarounds.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • After I update the web.xml, then also getting the same error. – Krishna Jan 31 '11 at 11:10
  • But, I have not added the attribute version="2.5". Is it necessary? I just copy pasted from another source. Which doesn't have that attribute. – Krishna Jan 31 '11 at 11:11
  • 1
    Either the environment does not support Servlet 2.5 at all or the classpath is polluted with old versioned libraries. First, what environment (servletcontainer/server) are you using? Tomcat 6.0? Tomcat 5.5? Glassfish v2? Glassfish v3? Etcetera. – BalusC Jan 31 '11 at 11:12
  • Sorry..I have specified the attribute version="2.5" – Krishna Jan 31 '11 at 11:14
  • 2
    Then the only reasonable reason left is that your classpath is messed up. You should **never** touch `JRE/lib` and `JRE/lib/ext` folders. You should **never** add/remove servletcontainer specific libraries in `Tomcat/lib` and `Webapp/WEB-INF/lib`. If there are any, you need to cleanup it. – BalusC Jan 31 '11 at 11:40
  • I have solved the problem. EL API is old version. After updating to the new version its working. – Krishna Jan 31 '11 at 11:41
  • 2
    That's a servletcontainer-specific library. You should not have the need to update it. It should already be included in `Tomcat/lib` and kept untouched there. If there is any in `Webapp/WEB-INF/lib`, you need to remove it. Take a look in `Tomcat/lib` of a fresh Tomcat installation and compare its contents with `Webapp/WEB-INF/lib`. If there are any similarly named libraries in webapp like `jsp-api`, `servlet-api`, etc, etc, you need to **remove** them all from the `Webapp/WEB-INF/lib`. They are supposed to be provided by the servletcontainer itself, not by your webapp. – BalusC Jan 31 '11 at 11:46
  • @BalusC I have followed your instructions, (the el-api is in the class path of tomcat lib). But still the exception is there. I am using tomcat 7.0. Before this, it was working fine on tomcat 6.0 –  Sep 03 '12 at 11:33
5

This is because latest el jar is not in classpath. It worked for me too

(Reference)Please refer the link JSF 2.0 + Tomcat : It appears the JSP version of the container is older than 2.1…

Sudhakar
  • 4,823
  • 2
  • 35
  • 42
  • I tried BalusC tip first, but the error still kept coming. After adding the latest el jar, the error went away. – Ray Hulha Mar 06 '12 at 15:38
1

Add the following to the Web.xml, it worked for me.

<context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
Cnu
  • 11
  • 2
1

you can try to remove following in Web.xml , it worked for me.

<context-param>
    <param-name>com.sun.faces.expressionFactory</param-name>
    <param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
andy
  • 11
  • 1