Main Tutorials

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.

For Eclipse IDE

If you are in debugging, make sure your server instance is able to find the javaee.jar file.

javax.el.ExpressionFactory

Or you can add it yourself with following steps

  1. Double clicks on the server instance.
  2. Click on the “Open launch configuration”.
  3. Add javaee.jar in “Bootstrap Entries”.

Reference

  1. How to download javaee.jar from Maven

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
2 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
sumeet
10 years ago

it didn’t solve the problem.

omar salem
8 years ago

solved my problem, thanks