0

I have a web application running in embedded Tomcat. If I run my TomcatRunner and access a JSP page, I get the following error:

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

I tried every similar error on StackOverflow and Google, but nothing work. Any idea?

My goal is Tomcat 9.0.35, (Servlet 4.0, JSP 2.3, EL 3.0)

my configuration:

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>4.0.1</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>2.3.3</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>jstl-api</artifactId>
        <version>1.2</version>
    </dependency>

(no taglib/standard)

In my JSP: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

In web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
    version="4.0">
    ...
</web-app>

After mvn clean package, I see target/.../WEB-INF/lib/jstl-1.2.jar ... but calling the JSP will lead in this error: 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 (I also tried the 'provided' mode without success)

Do you see any error ? do you have any demo application with JSP 2.3 and Tomcat 9.x embedded ? do you know how to trace jstl*jar search by Tomcat ?

Thanks for any help

  • 3
    Does this answer your question? [How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved](https://stackoverflow.com/questions/4928271/how-to-install-jstl-the-absolute-uri-http-java-sun-com-jstl-core-cannot-be-r) – Piotr P. Karwasz Mar 15 '21 at 17:33
  • 1
    This one managed to help me: I change the dependency to org.glassfish.web:jakarta.servlet.jsp.jstl:1.2.6, removed jstl-api dependency as it is a transitive dependency of jstl, Then I replaced tomcat.util.scan.StandardJarScanFilter.jarsToSkip=* empirically by theses (for my application) tomcat.util.scan.StandardJarScanFilter.jarsToSkip=iText*.jar,bcmail*.jar,bcprov*.jar,jaxb*.jar,jsr173*.jar,activation*.jar,mchange*.jar And it works. I could have used jarsToSkip=* and jarsToScan=..., but did not managed to identify all jars to include. Thanks – Cédric Dutoit Mar 16 '21 at 07:00
  • `jarsToScan` and `jarsToSkip` optimize by no more than a couple of seconds the application's startup. If you are using just the standard tags, `jarsToScan=jakarta.servlet.jsp.jstl*.jar` and `jarsToSkip=*` will work, but the [default values](https://github.com/apache/tomcat/blob/8e22617f9abf090481abea578cf4689cebc4901f/conf/catalina.properties) should be good enough. – Piotr P. Karwasz Mar 16 '21 at 07:17
  • This is not enough for me. I tried and managed to make my application run with: tomcat.util.scan.StandardJarScanFilter.jarsToSkip=* tomcat.util.scan.StandardJarScanFilter.jarsToScan=jakarta.servlet.jsp.jstl*.jar,spring-webmvc*jar,struts-tiles*jar,displaytag*jar This seems not to be an optimization. Without my previous jarsTo* or this one, the application raise the not found error. (PS: in my previous comment, iText* was meant to be on jarsToScan not jarsToSkip) – Cédric Dutoit Mar 16 '21 at 07:26
  • Sorry, I didn't notice that `jarsToSkip=*` disables scanning completely. `jarsToSkip=*.jar` and a non-empty `jarsToScan` should work. – Piotr P. Karwasz Mar 16 '21 at 07:57

0 Answers0