`
mywhy
  • 浏览: 66215 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

java.lang.NoClassDefFoundError: javax/el/ELException

阅读更多
在maven中配置以下依赖:

       <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

在resin-3.0.28中运行,报以下错误:

Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/el/ELException

原因是容器不支持JSTL1.2,换成以下依赖就好了:

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>

Tomcat中也有同样的问题

Tomcat6   JSP2.1 / Servlet2.5 / JSTL2.0

Tomcat5   JSP2.0 / Servlet2.4 / JSTL1.1

Tomcat4   JSP1.2 / Servlet2.3 / JSTL1.0

resin-3.0.28 JSP2.0 / Servlet2.4 / JSTL1.1

Tomcat5与Tomcat6的EL冲突,JSTL的版本问题
Servlet.service() for servlet jsp threw exception
java.lang.NoClassDefFoundError: javax/el/ELException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2365)
at java.lang.Class.getDeclaredMethods(Class.java:1763)
at java.beans.Introspector$1.run(Introspector.java:1259)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1257)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1125)
at java.beans.Introspector.getBeanInfo(Introspector.java:383)
at java.beans.Introspector.getBeanInfo(Introspector.java:155)
at java.beans.Introspector.getBeanInfo(Introspector.java:216)
at java.beans.Introspector.<init>(Introspector.java:364)
at java.beans.Introspector.getBeanInfo(Introspector.java:155)
at org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3673)
at org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2092)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1573)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)

这个问题应该是出在JSTL的支持上,通过查看,原来系统使用了JSTL1.2。

JSTL1.2

The JSTL 1.2 Maintenace Release aligns with the Unified Expression Language (EL) that is being delivered as part of the JavaServer Pages (JSP) 2.1 specification。JSTL 1.2 is part of the Java EE 5 platform. (from http://java.sun.com/products/jsp/jstl/)

JSTL1.1

Jakarta Taglibs hosts the Standard Taglib 1.1, an implementation of the JSP Standard Tag Library (JSTL), version 1.1, which was developed under the Java Community Process.
NOTE: Standard-1.1 (JSTL 1.1) requires a JSP container that supports the Java Servlet 2.4 and JavaServer Pages 2.0 specifications. Jakarta Tomcat 5 supports the new specifications. The Standard-1.1 taglib has been tested with Tomcat 5.0.3.

JSTL1.0
Standard-1.0 (implementation of the JSTL 1.0 specification) requires a JSP container that supports the Java Servlet 2.3 and JavaServer Pages 1.2 specifications. Jakarta Tomcat 4 supports these specifications. The Standard 1.0 taglib has been tested with Tomcat 4.1.24. (from http://jakarta.apache.org/taglibs/doc/standard-doc/intro.html)

Tomcat6 实现了servlet 2.5 和JSP2.1的规范,可以支持JSTL1.2;

而Tomcat5实现了 servlet 2.4 和JSP2.0的规范,只能支持JSTL1.1

所以,只要使用JSTL1.1(standard-1.1.jar和jstl-1.1.jar)替换JSTL1.2(jstl-1.2.jar)即可在Tomcat5下正常运行!

另外,web.xml必须指定使用servlet 2.4 和JSP2.0的规范:
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/gtuu0123/archive/2009/12/05/4946452.aspx

分享到:
评论

相关推荐

    javax/servlet/jsp/jstl/core/ConditionalTagSupport

    当你遇到`java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/ConditionalTagSupport`这样的异常时,意味着在运行时系统找不到这个类,这通常是由于缺少JSTL相关的依赖或者配置不正确所导致的。...

    juel-Tomcat与EL冲突问题

    启动Tomcat时报错:Caused by: java.lang.LinkageError: loader constraints violated when linking javax/el/ExpressionFactory class 说明:原因是juel.jar, juel-engine.jar, juel-impl.jar包和Tomcat6.0中的el-...

    javax.el-api-3.0.0.jar

    springboot 打war部署到apache-tomcat-7.0.69中启动报错:java.lang.NoClassDefFoundError: javax/el/ELManager 下载javax.el-api-3.0.0.jar,放到 tomcat/lib包下可以解决,原来的el-api.jar版本较低

    jstl 相关 jar

    比如: java.lang.NoClassDefFoundError: javax/el/ExpressionFactory 解决方法:下载javax.el.jar,部署到项目中。 其实使用JSTL(JSP标准标签库)和环境很有关系tomcat6.0和tomcat5.5所需要的包是不同的。如果...

    jstl1.1.jar和standard1.1.jar

    错误信息: java.lang.NoClassDefFoundError: javax/el/ExpressionFactory 分析:少包,上网查阅后发现解决方法 解决方法:将javaee.jar包再copy一份放在tomcat目录的common\lib下 如上完成后即解决了该异常,大...

    javax.el.rar

    当在页面中遇到`&lt;c:forEach&gt;`标签或其他JSP标签时,如果出现`java.lang.NoClassDefFoundError: javax/el/XXXXXX`错误,通常是因为缺少了EL相关的库文件。 错误`NoClassDefFoundError`表明在运行时找不到某个类,这...

    SpringBoot 2.0以上版本开发 部署到tomcat 7冲突的解决办法

    Caused by: java.lang.NoClassDefFoundError: javax/el/ELManager 查了一下发现,SpringBoot 2.0及以上版本需要一个能支持Servlet 3.1的容器。Tomcat 7只实现到Servlet 3.0,因此不能与SpringBoot 2.0一起使用。 ...

    el-api.jar 免费版

    默认安装好的TongWeb部署springboot项⽬启动时会报:java.lang.NoClassDefFoundError: javax/el/ELManager错误。 这是由于TongWeb的lib⽬录⾥⾯没有el-api.jar,通过拷贝tomcat的lib⽬录下的el-api.jar即

Global site tag (gtag.js) - Google Analytics