javax.servlet.jsp.JspException:Tomcat 5.5中的javax / el / ValueExpression

时间:2011-11-15 07:13:15

标签: java spring jstl tomcat5.5

我的Spring应用程序(webapp ver 2.5)在Tomcat 6.0上运行良好。但是,在我将其转换为webapp ver 2.4以在Tomcat 5.5上运行之后,我遇到了以下异常:

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)

我参考了JSTL库,如下所示:

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

我的图书馆有以下的罐子:

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

正如我从其他帖子中了解到的,它与jstl有关,而且jstl-1.2.jar是不兼容的。但是,对于jstl-1.1.2,jstl-1.1.1和jstl-1.1.0,我收到错误找不到“http://java.sun.com/jsp/jstl/的标记库描述符核心“在jsp中。我认为这可以通过添加c.tld和其他tld文件并在web.xml中引用这些文件来解决。为此,我想我需要将它们添加到我无法访问的tomcat文件夹中(我在共享的Tomcat上)。

我根据需要添加/删除了以下jar以解决此问题,但是有一个例外或另一个例外。

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

有人知道解决方案吗?

感谢。

1 个答案:

答案 0 :(得分:9)

/WEB-INF/lib列表中

jstl-1.2.jar

此JAR包含两者 JSTL 1.2 API和实现,而这又需要最少的Servlet 2.5 / JSP / EL 2.1。 {/ 1}}包是在JSP / EL 2.1中引入的,但Tomcat 5.5不支持它,因此解释了您在问题中发布的异常。

javax.el

此JAR包含JSTL 1.0实现和taglib。这实际上需要一个JSTL 1.0 API JAR文件。 JSTL 1.0的taglib URI也不同,它在URI中不包含standard-1.0.4.jar ,这解释了在用JSTL 1.1 API替换JSTL 1.2 API / impl时得到的taglib URI错误(不,JSTL 1.1) API库不包含impl!)。

Tomcat 5.5是一个Servlet 2.4容器,仅与JSTL 1.1一起使用。您需要删除两个上面提到的JAR(JSTL 1.2 API / impl和JSTL 1.0 impl),然后将它替换为JSTL 1.1的两个JAR,您可以下载here。您可以在ZIP文件的/jsp文件夹中找到jstl.jarstandard.jar