问题
在将JSF 2.0 Web应用程序部署到Tomcat 6.0.26时,出现“ 容器的JSP版本早于2.1 ”异常,并且无法启动Tomcat服务器。 但是JSP api v2.1包含在项目类路径中,为什么Tomcat仍然说JSP版本早于2.1?
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
这是错误堆栈…
SEVERE: Critical error during deployment:
...
Caused by: 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.
解
不太确定其根本原因,但是解决方案包括el-ri.jar库
<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>1.0</version>
</dependency>
PS此el-ri.jar在默认的Maven中央存储库中可用。
注意
JSF 2.0发行说明没有提及此el-ri.jar依赖库,这很奇怪。
更新– 2010年10月21日
此“ el-ri.jar”太旧了,建议使用Java.net上的最新“ el-impl-2.2.jar”
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>