2011-11-15 49 views
1

我讓我的Spring應用程序(webapp ver 2.5)在Tomcat 6.0上運行良好。javax.servlet.jsp.JspException:Tomcat 5.5中的javax/el/ValueExpression

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" %> 

我的圖書館有但是,之後我把它轉換爲Web應用程序版本2.4在Tomcat 5.5上運行,我遇到下面的例外來了下面罐子:

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/core」的標記庫描述符在jsp中爲。我認爲這可以通過添加c.tld和其他tld文件並在web.xml中引用這些文件來解決。爲此,我想我需要將它們添加到我無法訪問的tomcat文件夾(我在共享的Tomcat中)。

根據需要,我添加/刪除了下面的罐子來解決這個問題,但有一個例外或另一個。

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 

有人知道這個解決方案嗎?

謝謝。

+0

我不認爲你可以更新tomcat的el-api jar。 – Ralph

回答

9

從您的/WEB-INF/lib上市:

jstl-1.2.jar 

這個JAR包含的JSTL 1.2 API和實現,這又需要一個最低的Servlet 2.5/JSP/EL 2.1。在JSP/EL 2.1中引入了javax.el包,但Tomcat 5.5不支持它,因此解釋了您在問題中發佈的異常。

standard-1.0.4.jar 

這個JAR文件包含JSTL 1.0實現和標籤庫。這實際上需要一個JSTL 1.0 API JAR文件。 JSTL 1.0的taglib URI也是不同的,它在URI中不包含/jsp,因此解釋了在JSTL 1.1 API替換JSTL 1.2 API/impl時得到的taglib URI錯誤(不,JSTL 1.1 API庫不包含' t包含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。它是jstl.jarstandard.jar,您可以在ZIP文件的/lib文件夾中找到它。

+0

太好了!非常感謝。 – Luc