javax.servlet.jsp.JspException: javax/el/ValueExpression in Tomcat 5.5

James picture James · Nov 15, 2011 · Viewed 10.5k times · Source

I had my Spring app (webapp ver 2.5) running well on Tomcat 6.0. However, after I converted it to webapp ver 2.4 to run on Tomcat 5.5, I came across the below exception:

exception

org.apache.jasper.JasperException: javax.servlet.jsp.JspException: javax/el/ValueExpression
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: javax/el/ValueExpression
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
    org.apache.jsp.WEB_002dINF.jsp.index_jsp._jspService(index_jsp.java:141)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause

java.lang.NoClassDefFoundError: javax/el/ValueExpression
    java.lang.Class.getDeclaredMethods0(Native Method)
    java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
    java.lang.Class.getDeclaredMethods(Class.java:1791)
    java.beans.Introspector$1.run(Introspector.java:1287)
    java.security.AccessController.doPrivileged(Native Method)
    java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1285)
    java.beans.Introspector.getTargetMethodInfo(Introspector.java:1151)
    java.beans.Introspector.getBeanInfo(Introspector.java:402)
    java.beans.Introspector.getBeanInfo(Introspector.java:168)
    java.beans.Introspector.getBeanInfo(Introspector.java:229)
    java.beans.Introspector.<init>(Introspector.java:383)
    java.beans.Introspector.getBeanInfo(Introspector.java:168)
    java.beans.Introspector.getBeanInfo(Introspector.java:229)
    java.beans.Introspector.<init>(Introspector.java:383)
    java.beans.Introspector.getBeanInfo(Introspector.java:168)
    org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3729)
    org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2132)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1600)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1706)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1706)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
    org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Generator.generate(Generator.java:3321)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    org.apache.jsp.WEB_002dINF.jsp.index_jsp._jspx_meth_c_005fimport_005f1(index_jsp.java:186)
    org.apache.jsp.WEB_002dINF.jsp.index_jsp._jspService(index_jsp.java:104)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause

java.lang.ClassNotFoundException: javax.el.ValueExpression
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1363)
    org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1209)
    java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
    java.lang.Class.getDeclaredMethods0(Native Method)
    java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
    java.lang.Class.getDeclaredMethods(Class.java:1791)
    java.beans.Introspector$1.run(Introspector.java:1287)
    java.security.AccessController.doPrivileged(Native Method)
    java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1285)
    java.beans.Introspector.getTargetMethodInfo(Introspector.java:1151)
    java.beans.Introspector.getBeanInfo(Introspector.java:402)
    java.beans.Introspector.getBeanInfo(Introspector.java:168)
    java.beans.Introspector.getBeanInfo(Introspector.java:229)
    java.beans.Introspector.<init>(Introspector.java:383)
    java.beans.Introspector.getBeanInfo(Introspector.java:168)
    java.beans.Introspector.getBeanInfo(Introspector.java:229)
    java.beans.Introspector.<init>(Introspector.java:383)
    java.beans.Introspector.getBeanInfo(Introspector.java:168)
    org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3729)
    org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2132)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1600)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1706)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1706)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2216)
    org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2222)
    org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2166)
    org.apache.jasper.compiler.Generator.generate(Generator.java:3321)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.taglibs.standard.tag.common.core.ImportSupport.acquireString(ImportSupport.java:314)
    org.apache.taglibs.standard.tag.common.core.ImportSupport.doEndTag(ImportSupport.java:171)
    org.apache.jsp.WEB_002dINF.jsp.index_jsp._jspx_meth_c_005fimport_005f1(index_jsp.java:186)
    org.apache.jsp.WEB_002dINF.jsp.index_jsp._jspService(index_jsp.java:104)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:669)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I have reference to JSTL library like below:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

My library has the below jars:

asm-3.1.jar
cglib-2.1.jar
commons-codec-1.4.jar
commons-collections-3.2.jar
commons-lang-2.3.jar
commons-logging-1.1.jar
jackson-core-asl-1.7.1.jar
jackson-jaxrs-1.7.1.jar
jackson-mapper-asl-1.7.1.jar
jackson-xc-1.7.1.jar
jersey-client-1.8.jar
jersey-core-1.8.jar
jersey-json-1.8.jar
jersey-server-1.8.jar
jettison-1.1.jar
jsr311-api-1.1.1.jar
jstl-1.2.jar
mail-1.4.1.jar
org.springframework.aop-3.0.6.RELEASE.jar
org.springframework.asm-3.0.6.RELEASE.jar
org.springframework.aspects-3.0.6.RELEASE.jar
org.springframework.beans-3.0.6.RELEASE.jar
org.springframework.context-3.0.6.RELEASE.jar
org.springframework.context.support-3.0.6.RELEASE.jar
org.springframework.core-3.0.6.RELEASE.jar
org.springframework.expression-3.0.6.RELEASE.jar
org.springframework.instrument-3.0.6.RELEASE.jar
org.springframework.instrument.tomcat-3.0.6.RELEASE.jar
org.springframework.jdbc-3.0.6.RELEASE.jar
org.springframework.jms-3.0.6.RELEASE.jar
org.springframework.orm-3.0.6.RELEASE.jar
org.springframework.oxm-3.0.6.RELEASE.jar
org.springframework.test-3.0.6.RELEASE.jar
org.springframework.transaction-3.0.6.RELEASE.jar
org.springframework.web-3.0.6.RELEASE.jar
org.springframework.web.portlet-3.0.6.RELEASE.jar
org.springframework.web.servlet-3.0.6.RELEASE.jar
org.springframework.web.struts-3.0.6.RELEASE.jar
standard-1.0.4.jar
velocity-1.6.jar

As I learned from other posts, it has got something to do with jstl, and that jstl-1.2.jar is incompatible. However, with jstl-1.1.2, jstl-1.1.1 and jstl-1.1.0 I get an error Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" in jsp. I think this can be resolved by adding c.tld and other tld files and having a reference to these files in web.xml. For that I think I need to add them to tomcat folder, which I don't have access to (I'm on shared Tomcat).

I added/removed the below jars as required to fix this problem, but there's one exception or the other.

el-api-6.0.20.jar
jstl-1.1.0.jar
jstl-1.1.2.jar
jstl-1.2.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar

Anybody knows the solution to this?

Thanks.

Answer

BalusC picture BalusC · Nov 15, 2011

From your /WEB-INF/lib listing:

jstl-1.2.jar

This JAR contains both the JSTL 1.2 API and implementation, which in turn requires a minimum of Servlet 2.5 / JSP/EL 2.1. The javax.el package was introduced in JSP/EL 2.1, but Tomcat 5.5 doesn't support it, which thus explains the exception you posted in the question.

standard-1.0.4.jar

This JAR contains the JSTL 1.0 implementation and taglibs. This actually requires a JSTL 1.0 API JAR file along it. The taglib URI of JSTL 1.0 is also different, it doesn't contain /jsp in the URI, which thus explains the taglib URI error you got when replacing JSTL 1.2 API/impl by JSTL 1.1 API (no, the JSTL 1.1 API libs don't contain the impl!).

Tomcat 5.5 is a Servlet 2.4 container which works with JSTL 1.1 only. You need to remove both of the above mentioned JARs (JSTL 1.2 API/impl and JSTL 1.0 impl) and then replace it with the two JARs of JSTL 1.1 which you can download here. It are the jstl.jar and standard.jar which you can find in the /lib folder of the ZIP file.