java.lang.ClassNotFoundException: javax.el.ExpressionFactory
Problem
A Java web application deployed in Tomcat, hits the following error message :
javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/el/ExpressionFactory
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:268)
//...
java.lang.ClassNotFoundException: javax.el.ExpressionFactory
java.net.URLClassLoader$1.run(URLClassLoader.java:200)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
//...
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
Solution
The “javax.el.ExpressionFactory” class is belong to the “el-api.jar” library, you can download it from Maven central repository.
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
Alternative Solution
In some cases, Tomcat will still prompting the same error message even the “el-api.jar” file is included. Then you can try include J2EE standard API library, “javaee.jar“, it contains the “javax.el.ExpressionFactory” class as well, at least this is work for me.
Note
This “javaee.jar” could be find in your J2EE SDK folder.
This “javaee.jar” could be find in your J2EE SDK folder.
For Eclipse IDE
If you are in debugging, make sure your server instance is able to find the javaee.jar
file.
Or you can add it yourself with following steps
- Double clicks on the server instance.
- Click on the “Open launch configuration”.
- Add
javaee.jar
in “Bootstrap Entries”.
it didn’t solve the problem.
solved my problem, thanks