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

I am using JavaScript and JSF to develop an application for FB login website I have released my code here The problem is that when I run my application, it does not display the JSF page, but 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's the problem here and how can I solve it?

Solution

Because of the package name hint, the mentioned class is part of JSTL The exception clearly indicates that the class definition file of the mentioned class cannot be found in the runtime class path That is, config. Is missing in the runtime classpath of webapp Class file or at least jar file containing this class

JSTL is usually provided by a complete Java EE container (such as tomee, JBoss, as / EAP / wildfly, payara / GlassFish, Weblogic, etc.), but not by quasi system jsp / servlet containers (such as Tomcat and jetty) For them, you need to provide JSTL and web applications yourself, just like JSF (which is also provided by the complete Java EE container)

You are facing this exception because facelets's < C: XXX > tags depend on the JSTL implementation jar file, and you are using Tomcat JSTL can be used as an independent library for jstl-1.2 jar. Just download and put it in your webapp / WEB-INF / lib folder and the JSF jar file you have placed there, and the exception should disappear Maven users can do this by adding the following dependencies (and performing a full rebuild / redeployment):

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

Or, simply replace Tomcat. Net with a real Java EE container

You can also see:

>Our JSF wiki page – contains JSF installation instructions

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>