JSTL 1.1升级到1.2失败,并出现java.lang.AbstractMethodError:javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext [英] Upgrading JSTL 1.1 to 1.2 fails with java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext

查看:120
本文介绍了JSTL 1.1升级到1.2失败,并出现java.lang.AbstractMethodError:javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JSTL时出现错误.请帮助我.

i getting error when i using JSTL. Please to help me.

我在Tomcat 7中使用jstl-impl-1.2.jar和jstl-api-1.2.jar,我取出了standard.jsp和jstl.jsp,但仍然遇到此错误.

i using jstl-impl-1.2.jar and jstl-api-1.2.jar in my tomcat 7 and i take out standard.jsp and jstl.jsp but still hitting this error.

错误代码

java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
javax.servlet.jsp.jstl.core.LoopTagSupport.unExposeVariables(LoopTagSupport.java:624)

Web.xml

<web-app 
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">

推荐答案

您的/WEB-INF/lib(或更糟糕的是,您的JRE/libJRE/lib/ext)被servlet容器特定的库(如jsp-api.jar)所污染,而该库又不同又更旧版本的servlet容器的制造/版本.您需要在Webapp的/WEB-INF/lib中删除它们.这些库应该已经由servlet容器本身提供了,在您的情况下就是Tomcat.

Your /WEB-INF/lib, or worse, your JRE/lib or JRE/lib/ext, is polluted with servletcontainer-specific libraries like jsp-api.jar of a different and older-versioned servletcontainer make/version. You need to get rid of them in your webapp's /WEB-INF/lib. Those libraries are supposed to be already provided by the servletcontainer itself, which is in your case Tomcat.

在您的特定示例中,

In your particular example, the javax.servlet.jsp.PageContext.getELContext() method, which exist since JSP 2.1 only, is requested by Tomcat's internal classes, but it could not be found in the JSP API, because you've an older versioned one (apparently JSP 2.0 or older) in your webapp which got precedence in classloading over Tomcat's own one.

换句话说,直到将JSTL升级到与Tomcat 6兼容的Tomcat 7为止,Tomcat 7一直都在运行tomcat 5.5或更早的版本.

In other words, your Tomcat 7 was running like as tomcat 5.5 or older all the time until you upgraded JSTL to a Tomcat 6 compatible one.

这篇关于JSTL 1.1升级到1.2失败,并出现java.lang.AbstractMethodError:javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆