52

I am using JDK 1.7, Apache Tomcat 7.0.23 and I have placed JSTL core library(1.2) and STANDARD jar in WEB_INF lib folder it is not giving me any warning but when I will try to run the code

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- Create Bean Instance-->
<jsp:useBean id="listdomain" class="bean.PopulateMultiDomain" scope="session"></jsp:useBean>

<jsp:setProperty property="*" name="listdomain"/>

<c:forEach var="item" items="${listdomain.status}">
    <option>
        <c:out value="${item}" />
    </option>
</c:forEach> 

it gives me the following error:

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:56)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:410)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:117)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:311)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:152)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:410)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:475)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1425)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:242)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:102)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

Can anyone suggest me what mistake I am making?

Reinderien
  • 11,755
  • 5
  • 49
  • 77
Nishit Jain
  • 1,549
  • 8
  • 21
  • 33
  • 3
    This is not a duplicate question - in the question linked as a duplicate, the URI is incorrect. In this one the URI is correct, but the poster gets a similar error. – TimK Jan 29 '16 at 13:39
  • for me even though I have devtools set up to reload everything, I had to shut down the server and restart, that fixed it for me. – JesseBoyd Aug 03 '19 at 22:15

10 Answers10

49

Remove the standard.jar. It's apparently of old JSTL 1.0 version when the TLD URIs were without the /jsp path. With JSTL 1.2 as available here you don't need a standard.jar at all. Just the jstl-1.2.jar in /WEB-INF/lib is sufficient.

See also:

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Thank you.. It helped a lot. – Dil. Jun 04 '15 at 05:17
  • @BalusC in `IDEA` the lib folder is not there what is the correct place to add `JSTL` libs in `Intellij IDEA` – Kasun Siyambalapitiya May 18 '17 at 05:41
  • 1
    @BalusC In my case i am using jstl 1.1.1 and I am having same issue. After seeing your answer i came to know standard jar is need along with jstl 1.1.1. When i added standard jar to lib, this issue is resolved. Thanks – user2723039 Aug 07 '18 at 19:39
24

I solved the same problem. I've just added JSTL-1.2.jar to /apache-tomcat-x.x.x/lib and set scope to provided in maven pom.xml:

 <dependency>
     <groupId>jstl</groupId>
     <artifactId>jstl</artifactId>
     <version>1.2</version>
     <scope>provided</scope>
 </dependency>
krock
  • 28,904
  • 13
  • 79
  • 85
Yauhen
  • 2,435
  • 1
  • 17
  • 18
  • If that was the only thing that worked, then the project/pom in question is apparently not targeted at Tomcat at all, but at a real Java EE server (GlassFish, WildFly, etc). You've then actually other problems. – BalusC Oct 04 '15 at 09:47
10

Make sure you didn't skip all jars in

tomcat.util.scan.StandardJarScanFilter.jarsToSkip

in Tomcat catalina.properties.

MGorgon
  • 2,547
  • 23
  • 41
3

I have removed the scope and then used a maven update to solve this problem.

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    **<!-- <scope>provided</scope> -->**
</dependency>

The jstl lib is not present in the tomcat lib folder.So we have to include it. I don't understand why we are told to keep both servlet-api and jstl's scope as provided.

Community
  • 1
  • 1
Nirmalya Kar
  • 511
  • 4
  • 9
2

The error in question may also be caused by disabled JarScanner in tomcat/conf/context.xml.

See also Upgrade from Tomcat 8.0.39 to 8.0.41 results in 'failed to scan' errors.

<JarScanner scanManifest="false"/> allows to avoid both problems.

Community
  • 1
  • 1
Vadzim
  • 24,954
  • 11
  • 143
  • 151
2

if you use spring boot check in application.propertiese this property is commented or remove it if exist.

server.tomcat.additional-tld-skip-patterns=*.jar

Community
  • 1
  • 1
Ahmad R. Nazemi
  • 775
  • 10
  • 26
1

If you are using eclipse and maven for handling dependencies, you may need to take these extra steps to make sure eclipse copies the dependencies properly Maven dependencies not visible in WEB-INF/lib (namely the Deployment Assembly for Dynamic web application)

Colin D
  • 2,822
  • 1
  • 31
  • 38
0

This might be because of the transitive dependencies.

Try to add/ remove the scope from the JSTL library.

This worked for me!

Dharman
  • 30,962
  • 25
  • 85
  • 135
Gru
  • 67
  • 1
  • 7
0

If you are using maven project then you just need to add the jstl-1.2 jar in your dependency. If you are simply adding the jar to your project then it's possible that jar file is not added in your project project artifact. You simply need to add the jar file in WEB-INF/lib file.

enter image description here

This is how your project should look when jstl is not added to the artifact. Just hit the fix button and intellij will add the jar file in the above mentioned path. Run the project and bang.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
-1

I was facing the same issue, to solve it I have added the below entry in pom.xml and performed a maven update.

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
</dependency>
aymericbeaumet
  • 6,853
  • 2
  • 37
  • 50