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

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

问题描述

我正在使用Javascript和JSF开发用于FB登录的应用程序.我已将代码发布在

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. webapp的运行时类路径中缺少Config.class文件或至少包含该类的JAR文件.

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容器(例如 JBoss AS / EAP / WildFly Payara / Tomcat 和 Jetty .对于他们,您需要自己随Web应用程序一起提供JSTL,就像您对JSF所做的一样(完全成熟的Java EE容器也已经提供了JSF).

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具有其 <c:xxx>标记对JSTL实现JAR文件的依赖性,而您使用的是Tomcat,而Tomcat并未随JSTL一起提供. JSTL是一个独立的库,以 jstl-1.2的形式提供.jar .只需将其与已经放置在其中的JSF JAR文件一起下载并拖放到webapp的/WEB-INF/lib文件夹中,此异常应消失. 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天全站免登陆