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

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

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 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).

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>

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

See also:

Leave a Comment