Im trying to create a basic JSF application but can’t seem to get it to work – I suspect something is missing, by default in the faces-config.xml file but I’m not sure what. I recieve this error:
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
I googled it and found it to be a supposedly missing jar file. This I downloaded and added to the ‘Build Path’ of the project, refreshed and restarted the server but it still didn’t work. The external JAR file is called ‘jstl-1.2.jar.’
Here’s a list of the error/s being reported:
HTTP Status 500 - javax/servlet/jsp/jstl/core/Config
type Exception report
message javax/servlet/jsp/jstl/core/Config
description The server encountered an internal error that prevented it from fulfilling
this request.
exception
javax.servlet.ServletException: javax/servlet/jsp/jstl/core/Config
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
root cause
java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config
com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:345)
com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
root cause
java.lang.ClassNotFoundException: javax.servlet.jsp.jstl.core.Config
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:345)
com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.32 logs.
Any ideas? This has to be a simple fix as it cannot be this complicated to get a simple HelloWorld popping out from a JSF application.
Cheers
This is not the correct approach. You should not touch the Build Path property of the project at all. You should just drop the JSTL JAR file straight into
/WEB-INF/libfolder of the project. You should make sure that you undo every change you made in Build Path property in a careless attempt to "fix" this, otherwise the webapp will still be build/deployed with a broken classpath/library structure.Why you need it is because JSF2 Facelets is requiring the JSTL dependency for functioning of all
<c:xxx>tags as listed here. However, you’re using Tomcat which is a barebones JSP/Servlet container which doesn’t ship with JSTL out the box. You’d have to download and install it separately. On full fledged containers like Glassfish you don’t have the need to do this (also not for JSF JAR files, by the way).See also: