java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator [英] java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
问题描述
我按照此链接中的指南来安装 JSTL,但是当我尝试启动 JSP 时出现以下错误页面:
I followed the guide in this link to install JSTL but I got the following error when I tried to launch my JSP page:
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
taglib 声明是:
The taglib declaration is:
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
我在 Tomcat webapps 中的 /WEB-INF/lib
下安装了 JSTL 1.1,并尝试在我的项目中做同样的事情,但没有奏效.我还尝试了 JSTL 的 1.2 版,但仍然是相同的消息.这是怎么引起的,我该如何解决?
I installed JSTL 1.1 under /WEB-INF/lib
in Tomcat webapps and tried to do the same in my project, but it didn't work. I also tried version 1.2 of JSTL and still the same message. How is this caused and how can I solve it?
推荐答案
javax.servlet.jsp.tagext.TagLibraryValidator 类是在 JSP 2.0 中引入的.因此,此错误可能有以下可能的原因:
The javax.servlet.jsp.tagext.TagLibraryValidator class is introduced in JSP 2.0. This error can thus have the following possible causes:
您没有运行与 JSP 2.0 兼容的 serlvetcontainer.例如,Tomcat 4.x 或 5.0.您至少需要 Tomcat 5.5 或更高版本、6.0 或更好的 7.0.只是最新版本.
You are not running a JSP 2.0 compatible serlvetcontainer. For example, Tomcat 4.x or 5.0. You need at least Tomcat 5.5 or better, 6.0, or even better, 7.0. Just the latest version.
你已经用任意下载的 jsp-api.jar
或 j2ee.jar
文件弄乱了 /WEB-INF/lib
或任何包含 JSP API 的内容,它源自完全不同的 servletcontainer make/version,而后者实际上不符合 JSP 2.0.摆脱那些图书馆.你不需要它们.如果您这样做是为了解决编译错误,那么您的做法就错了.它们应该在编译时类路径中结束,而不是在运行时类路径中.另请参阅 如何导入 javax我的 Eclipse 项目中的 .servlet API?
You have cluttered the /WEB-INF/lib
with arbitrarily downloaded jsp-api.jar
or j2ee.jar
files or whatever contains the JSP API, which originates from a completely different servletcontainer make/version which in turn was actually not JSP 2.0 compliant. Get rid of those libraries. You don't need them. If you did this to workaround compilation errors, then you did it the wrong way. They should end up in compiletime classpath, not in the runtime classpath. See also How do I import the javax.servlet API in my Eclipse project?
这篇关于java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!