java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config [英] java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

查看:50
本文介绍了java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Javascript 和 JSF 开发带有网站的 FB 登录应用程序.我已将我的代码发布在 这里.问题是,当我运行我的应用程序时,它没有显示 JSF 页面,而是抛出以下异常:

I am developing an application for FB Login with website using Javascript and JSF. I have posted my code at here. The problem is, when I run my application it does't show the JSF page, it instead throws the following exception:

Nov 28, 2013 7:21:46 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path [/FacebookLogin] threw exception [javax/servlet/jsp/jstl/core/Config] with root cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
    at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:344)
    at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:153)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

这里有什么问题,我该如何解决?

What is the problem here and how can I solve it?

推荐答案

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config

正如包名所暗示的那样,提到的类是 JSTL 的一部分.异常清楚地表明在运行时类路径中找不到提到的类的类定义文件.IE.Config.class 文件或至少包含该类的 JAR 文件在 webapp 的运行时类路径中丢失.

As the package name hints, the mentioned class is part of JSTL. The exception is clearly telling that the class definition file of the mentioned class cannot be found in the runtime classpath. I.e. the Config.class file or at least the JAR file containing that class is missing in webapp's runtime classpath.

JSTL 通常已经由成熟的 Java EE 容器(例如 TomEE, JBoss ASa>/EAP/WildFly, Payara/GlassFishWebLogic 等,但不是由准系统 JSP/Servlet 容器,例如 TomcatJetty.对于他们,您需要自己提供 JSTL 和 Web 应用程序,就像您为 JSF 所做的一样(也已经由成熟的 Java EE 容器提供).

JSTL is normally already provided out the box by a full fledged Java EE container such as TomEE, JBoss AS/EAP/WildFly, Payara/GlassFish, WebLogic, etc but not by barebones JSP/Servlet containers such as Tomcat and Jetty. For them, you'd need to supply JSTL along with the web application yourself, exactly like as you'd do for JSF (which is also already provided out the box by full fledged Java EE containers).

您遇到此异常是因为 Facelets 为其 标签 对 JSTL 实现 JAR 文件的依赖,而您使用的 Tomcat 并未随 JSTL 一起提供.JSTL 是一个独立的库,具有 jstl-1.2.jar.只需将它下载并放到您的 web 应用程序的 /WEB-INF/lib 文件夹中,连同您已经放置在那里的 JSF JAR 文件,这个异常就会消失.Maven 用户可以通过添加以下依赖项(并执行完全重建/重新部署)来实现:

You're facing this exception because Facelets has for its <c:xxx> tags a dependency on the JSTL implementation JAR file, while you're using Tomcat which doesn't ship with JSTL out the box. JSTL is as a separate library available in flavor of jstl-1.2.jar. Just download and drop it in your webapp's /WEB-INF/lib folder, along with the JSF JAR file(s) which you already placed there, and this exception should disappear. Maven users can achieve that by adding the below dependency (and performing a full rebuild/redeploy):

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

或者,只需将 Tomcat 替换为真正的 Java EE 容器即可.

Alternatively, just replace Tomcat by a real Java EE container.

  • Our JSF wiki page - contains JSF installation instructions

这篇关于java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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