1

I have tried everything in the multiple threads on this site (non of them were for Tomcat 10 and non of the solved problem. I am using Apache NetBeans 11.1 with Apache Tomcat 10.0.0-M1. Below is my configuration -- if I remove the taglib line from my jsp file, the error goes away.

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">

    <!-- Config here. -->

</web-app>

pom.xml dependencies:

<dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.5</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20190722</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
            <type>jar</type>
        </dependency>
        <dependency>
           <groupId>com.zaxxer</groupId>
           <artifactId>HikariCP</artifactId>
           <version>3.3.1</version>
           <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.1.10.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.1.10.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
            <!--scope>provided</scope-->
        </dependency>
    </dependencies>

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>

    </head>
    <body>
        <h1>Test Results</h1>
        <testResults></testResults>
    </body>
</html>

error displayed:

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:55)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:294)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:81)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:251)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:122)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:489)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1445)
    org.apache.jasper.compiler.Parser.parse(Parser.java:144)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:105)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:206)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:386)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:605)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:400)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    jakarta.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:955)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:128)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
    jakarta.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    jakarta.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Ed wolfe
  • 31
  • 1
  • 3

2 Answers2

3

I found out that on Tomcat 10 you can use apache-taglibs 1.2.5 migrated with tomcat migration tool with jakarta-jstl-api 2.0, or use glassfish jstl implementation, that works just fine.

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jakarta.servlet.jsp.jstl</artifactId>
    <version>2.0.0-M1</version>
</dependency>
swch
  • 1,432
  • 4
  • 21
  • 37
  • I can not use "Glassfish JSTL implementation" with Tomcat 10.0.7 which released on 2021-06-15. However, the above implementation works fine with Tomcat 10.0.6 which has moved into the apache archive directory. – Muhammad Shah Jun 22 '21 at 02:51
1

The Apache Tomcat team gave me the solution via e-mail (Thanks Mark):

From the Tomcat 10.0.0-M1 release announcement:

Users of Tomcat 10 onwards should be aware that, as a result of the move from Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse Foundation, the primary package for all implemented APIs has changed from javax.* to jakarta.*. This will almost certainly require code changes to enable applications to migrate from Tomcat 9 and earlier to Tomcat 10 and later.

        <dependency>

            <groupId>javax</groupId>

            <artifactId>javaee-web-api</artifactId>

            <version>8.0.1</version>

            <scope>provided</scope>

        </dependency>

That is never going to work on Tomact 10. You can't use Java EE 8 libraries with a Jakarta EE 9 server.

        <dependency>

            <groupId>javax.mail</groupId>

            <artifactId>mail</artifactId>

            <version>1.4.7</version>

            <type>jar</type>

        </dependency>

That needs to be replaced with Jakarta Mail (there might be an RC for that on Maven Central)

        <dependency>

            <groupId>org.springframework</groupId>

            <artifactId>spring-web</artifactId>

            <version>5.1.10.RELEASE</version>

        </dependency>

That won't work and, as far as I am aware, there is no Jakarta EE 9 version available (or even being worked on) yet.

        <dependency>

            <groupId>javax.servlet</groupId>

            <artifactId>jstl</artifactId>

            <version>1.2</version>

            <!--scope>provided</scope-->

        </dependency>

You need the Jakarta Standard Tag Library 2.0 or later. I think that is one of the Jakarta projects struggling for active committers.

Tomcat 10 ships with an API and implementation for the Jakarta Standard Tag Library 2.0 in the examples web application. It was created by taking the JSTL 1.2 JARs and running them through Tomcat's Java EE 8 to Jakarta EE 9 conversion / migration tool.

test.jsp

Might sticking with Tomcat 9 be a better option for you for now?

Mark

Ed wolfe
  • 31
  • 1
  • 3