7

I restarted the httpd and tomcat service today, and after doing so. I was greeted with the following message.

I saw this thread http://www.coderanch.com/t/592922/Tomcat/enable-el-api-jar-ver

And did as they told. I checked, and the el-api.jar is there. I checked another server, and tomcat is running great with it as well.

The server is a Centos 6.4 (final) and Tomcat 7.0.23.

I tried everything, even replacing the jar files, but nothing seems to work.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.el.ELException: Provider com.sun.el.ExpressionFactoryImpl not found
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:585)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:396)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause

javax.el.ELException: Provider com.sun.el.ExpressionFactoryImpl not found
    javax.el.FactoryFinder.newInstance(FactoryFinder.java:101)
    javax.el.FactoryFinder.find(FactoryFinder.java:197)
    javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:189)
    javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:160)
    org.apache.jasper.runtime.JspApplicationContextImpl.getExpressionFactory(JspApplicationContextImpl.java:108)
    org.apache.jsp.index_jsp._jspInit(index_jsp.java:31)
    org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause

java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
    javax.el.FactoryFinder.newInstance(FactoryFinder.java:87)
    javax.el.FactoryFinder.find(FactoryFinder.java:197)
    javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:189)
    javax.el.ExpressionFactory.newInstance(ExpressionFactory.java:160)
    org.apache.jasper.runtime.JspApplicationContextImpl.getExpressionFactory(JspApplicationContextImpl.java:108)
    org.apache.jsp.index_jsp._jspInit(index_jsp.java:31)
    org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.23 logs.
Ted Pat
  • 87
  • 1
  • 1
  • 4

2 Answers2

7

Please, make sure you have both these jars at ${TOMCAT_HOME}/lib

el-api-2.2.jar // jar version could differ
el-impl-2.2.jar
Ravi K Thapliyal
  • 51,095
  • 9
  • 76
  • 89
  • 1
    I tried it, and it's giving me this error now. http://stackoverflow.com/questions/8487048/java-lang-linkageerror-javax-servlet-jsp-jspapplicationcontext-getexpressionfac – Ted Pat Jun 26 '13 at 08:27
  • Does, the accepted answer help? You need to verify that you don't have any server-provided jars in your application's `/WEB-INF/lib` directory. – Ravi K Thapliyal Jun 26 '13 at 08:29
  • No it doesn't. I made sure I removed the original el-api.jar. Still the same error is obtained. I think it's caused by the ep-api and el-imp conflicting with each other.. – Ted Pat Jun 26 '13 at 08:30
  • Where are you placing the jars. Within your app's lib folder or tomcat's lib directory? – Ravi K Thapliyal Jun 26 '13 at 08:54
  • The tomcat lib. I'm getting his error on the main page of tomcat. For example http://www.xxxxxx.com:8080 – Ted Pat Jun 26 '13 at 08:55
  • 19 before I replaced the el-api.jar. Now 20 with el-api-2.2.jar and el-impl-2.2.jar – Ted Pat Jun 26 '13 at 09:00
  • Okay, I just checked my local Tomcat 7 install and it has 19 files with just el-api.jar. But, I don't use expressions on it and the el-api.jar certainly doesn't have the `com.sun.el.ExpressionFactoryImpl` class. File size on `dir` is 46,084. – Ravi K Thapliyal Jun 26 '13 at 09:04
  • This is what's very weird. Another server also has 19 with the original el-api.jar and it's working fine.. :/ – Ted Pat Jun 26 '13 at 09:06
  • Okay, just checked the default install uses `org.apache.el.ExpressionFactoryImpl` from `jasper-el.jar`. Can you check your `web.xml` is not overriding it? – Ravi K Thapliyal Jun 26 '13 at 09:07
  • Orverriding it how? The only mention of jasper is org.apache.jasper.servlet.JspServlet and no mention of expression. Or did you mean the catalina.properties? – Ted Pat Jun 26 '13 at 09:12
  • I've seen context params pointing to com.sun.el.* class in certain JSF environments. – Ravi K Thapliyal Jun 26 '13 at 09:19
  • Why don't you do a find for all *el*.jar files under tomcat directory? something is definitely interfering. – Ravi K Thapliyal Jun 26 '13 at 09:21
  • I did try searching for it. I only got the ones I added. And I cannot see any reference to any el.* classes, apache or sun. – Ted Pat Jun 26 '13 at 09:23
  • Ah, try replacing `jasper-el.jar` with `el-impl.jar`. There's no reason why two implementations would co-exist. This would explain the `LinkageError` as well. – Ravi K Thapliyal Jun 26 '13 at 09:25
  • It turned out one of the applications I had installed had a library that had el inside it. Which was weird considering I was opening the manager and not the app. I uninstalled it, restarted the tomcat and apache, and reinstalled it, and it seemed to have worked now. – Ted Pat Jun 27 '13 at 09:00
  • @TedPat Hey, glad you got it working. I'm guessing you now have just the el-api.jar (with jasper-el.jar) in Tomcat just like the default install and that you reinstalled the other app with el.jar removed. Thanks for sharing. – Ravi K Thapliyal Jun 27 '13 at 12:01
  • thanks a lot,Ravi. my war was not working when i migrated to 7.0.47 from 6.0 and after adding these two jar it worked without touching the code. helped me and saved a lot of time. – sana May 05 '14 at 15:05
  • @sana Glad to know the answer helped. Thanks for sharing. – Ravi K Thapliyal May 10 '14 at 21:28
0

I got the same error today on Tomcat 9.0.21

and as per this bug - https://bz.apache.org/bugzilla/show_bug.cgi?id=64097

It is a known bug with "el-api.jar" and has been fixed in following versions

Fixed in:

  • master for 10.0.0.0-M1 onwards
  • 9.0.x for 9.0.31 onwards
  • 8.5.x for 8.5.51 onwards
  • 7.0.x for 7.0.100 onwards

Solution :- You can upgrade tomcat to these versions or just bring over the "el-api.jar" from the lib folder of a newer tomcat (which has the fix), place it in your lib folder and restart tomcat. It would work.