java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;

匆匆过客 提交于 2019-12-31 04:22:57

问题


I am trying to set a variable that I will refer to in a custom JSP tag, so I have something like this in my JSP:

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

However, I am getting this error when The JSP runs:

java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContext;
    at org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.java:140)

I am running Tomcat 5.5, and Java 1.5, with JSTL 1.2.

Am I doing something wrong here?

Thanks!


回答1:


Looks like you may have some versioning problem, maybe a conflicting jar file of some sort. Look here, maybe it'll help. You need to supply some more info about your runtime environment if you can't solve it.




回答2:


This seems to come up quite a bit. We had Hadoop as a dependency and had to do multiple exclusions. Some of these are probably redundant, but this finally worked. I should note that there was no change until I started excluding Jasper at the bottom.

<exclusions>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jsp-2.1</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jsp-api-2.1</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jsp-api</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>servlet-api</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>servlet-api-2.5</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty</artifactId>
    </exclusion>
    <exclusion>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-util</artifactId>
    </exclusion>
    <exclusion>
        <groupId>tomcat</groupId>
        <artifactId>jasper-compiler</artifactId>
    </exclusion>
    <exclusion>
        <groupId>tomcat</groupId>
        <artifactId>jasper-runtime</artifactId>
    </exclusion>
</exclusions>



回答3:


Tomcat 5.5 does not support Servlet API 2.5 which is used by JSTL 1.2.

Upgrade to Tomcat 6.0 or downgrade the Servlet / JSP / JSTL versions.

see http://tomcat.apache.org/whichversion.html



来源:https://stackoverflow.com/questions/542383/java-lang-abstractmethoderror-javax-servlet-jsp-pagecontext-getelcontextljava

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!