I am getting a frustrating error in my JSP file stating "Can not find the tag library descriptor for http://java.sun.com/jsp/jstl/core". I have added the dependency to my pom.xml, but the server still won't recognize the URI. This is happening in a legacy Java web project I'm trying to modernize. Does anyone know if this is a classpath issue, or do I need to manually add the TLD files to my WEB-INF folder to get the core tags working again?
3 answers
This error usually occurs because the JSTL library is not present in the runtime classpath of your container, even if it is in your IDE. If you are using Maven, ensure you have both the jstl and standard dependencies, or the modern jakarta.servlet.jsp.jstl if you are on a newer server. Most importantly, check that your web.xml version matches the JSTL version you are using. For older projects, you might need to ensure the JAR files are physically located in /WEB-INF/lib, as some older versions of Tomcat do not automatically scan external Maven libraries unless configured to do so.
Are you using a specific Application Server like GlassFish or just a plain Tomcat instance? Sometimes the server provides these libraries out of the box, and adding them again causes a conflict.
I found that updating the Project Facets in Eclipse to match the correct Dynamic Web Module version often resolves these phantom TLD errors.
That is a great point, Jeffrey. I’ve had the same issue where the IDE's internal validation was stricter than the actual compiler. Updating the facets usually clears the red markers instantly.
If you are using Tomcat, it does not include JSTL by default. You should download the JSTL 1.2 JAR and place it in the lib folder. Also, make sure your URI is exactly "http://java.sun.com/jsp/jstl/core" and not the version with the "jakarta" prefix unless you have migrated your entire project to the Jakarta namespace, as mixing them will definitely cause a TLD search failure.