Related: Jetty - upgrading 9.3.0.M1 to 9.3.0.M2 breaks JSP functionality using Maven
I have a legacy maven project running on JDK 1.8 (yup, old) that I need to upgrade to JDK 17.
It runs on an embedded Jetty instance version 9.2.23.v20171218.
I've spent all day trolling through SO trying at least 9 different fixes advised by others, none work. I have no web.xml file or web-INF folder, virtually all posts refer to these folders in the project?
Also it is an embedded instance of Jetty (which seems quite unique and a strange use case?)
The exception on trying to access the project's index.jsp in a browser is
org.apache.jasper.JasperException: /index.jsp(1,64) PWC6188: 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
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:172)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:431)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:240)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:502)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:582)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1657)
at org.apache.jasper.compiler.Parser.parse(Parser.java:185)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:244)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:145)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:212)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:377)
at org.eclipse.jetty.jsp.JettyJspServlet.service(JettyJspServlet.java:103)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.base/java.lang.Thread.run(Thread.java:833)
------------------------------------------------------------
I'm aware there are at least 30 posts about this same issue - I've spent today working through them one by one, no joy...
The error seems related to the fact that the TLD in the JSP tag at the top of my index.jsp is not mapped to the correct class in the referenced JAR, and this only matters if running in any JDK higher then 1.8 (dropped JDK17 and tried JDK11, it also doesn't work). Any JDK above 1.8 seems to give the above exception, and Jetty fails to parse any .JSP files anymore.
I have the following Maven artifacts as suggested by various SO posts:
.
.
.
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
.
.
.
and can confirm in NetBeans 14 that in "Dependencies" I have
jstl-1.2.jar
jstl-api-1.2.jar
If I open jstl-1.2.jar in the Netbeans 14 project view, I can see the exact class complained about, e. g.
jstl-1.2.jar
>.
.
.
javax.servlet.jsp.jstl.core
javax.servlet.jsp.jstl.fmt
.
.
.
are present in the project JAR.
My .jsp page's first lines are
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
.
.
.
How can I get Jetty / Jasper to find jstl-1.2.jar's "fmt" and "core" classes inside the JAR above in my project, and map the TLDs above to those classes so I can get JSP functionality back in any JDK higher than 1.8?
(As stated, JDK 1.8 works with the above codebase as-is, any JDK of a higher version fails with above exception.)
ANY help or suggestions appreciated!
Thanks
My mvn dependency:tree:
--- maven-dependency-plugin:2.8:tree (default-cli) @ verdi ---
[INFO] verishare:verdi:jar:1.0-SNAPSHOT
[INFO] +- org.slf4j:slf4j-simple:jar:1.7.21:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.17.1:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.17.1:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.eclipse.jetty.websocket:websocket-client:jar:9.2.23.v20171218:compile
[INFO] | +- org.eclipse.jetty:jetty-util:jar:9.2.23.v20171218:compile
[INFO] | +- org.eclipse.jetty:jetty-io:jar:9.2.23.v20171218:compile
[INFO] | \- org.eclipse.jetty.websocket:websocket-common:jar:9.2.23.v20171218:compile
[INFO] | \- org.eclipse.jetty.websocket:websocket-api:jar:9.2.23.v20171218:compile
[INFO] +- org.eclipse.jetty:jetty-server:jar:9.2.23.v20171218:compile
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | \- org.eclipse.jetty:jetty-http:jar:9.2.23.v20171218:compile
[INFO] +- org.eclipse.jetty:jetty-servlet:jar:9.2.23.v20171218:compile
[INFO] | \- org.eclipse.jetty:jetty-security:jar:9.2.23.v20171218:compile
[INFO] +- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] +- org.glassfish:javax.json:jar:1.0.4:compile
[INFO] +- org.apache.commons:commons-dbcp2:jar:2.5.0:compile
[INFO] | +- org.apache.commons:commons-pool2:jar:2.6.0:compile
[INFO] | \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- postgresql:postgresql:jar:9.1-901-1.jdbc4:compile
[INFO] +- org.eclipse.jetty:jetty-webapp:jar:9.2.23.v20171218:compile
[INFO] | \- org.eclipse.jetty:jetty-xml:jar:9.2.23.v20171218:compile
[INFO] +- org.eclipse.jetty:jetty-jsp:jar:9.2.23.v20171218:compile
[INFO] | +- org.eclipse.jetty.toolchain:jetty-schemas:jar:3.1.M0:compile
[INFO] | +- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:compile
[INFO] | +- org.glassfish.web:javax.servlet.jsp:jar:2.3.2:compile
[INFO] | +- org.eclipse.jetty.orbit:javax.servlet.jsp.jstl:jar:1.2.0.v201105211821:compile
[INFO] | +- org.glassfish.web:javax.servlet.jsp.jstl:jar:1.2.2:compile
[INFO] | +- org.glassfish:javax.el:jar:3.0.0:compile
[INFO] | \- org.eclipse.jetty.orbit:org.eclipse.jdt.core:jar:3.8.2.v20130121:compile
[INFO] +- com.microsoft.sqlserver:mssql-jdbc:jar:6.4.0.jre8:compile
[INFO] +- org.mariadb.jdbc:mariadb-java-client:jar:2.7.4:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.5.1:compile
[INFO] | +- org.apache.httpcomponents:httpcore:jar:4.4.3:compile
[INFO] | \- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- org.glassfish.jersey.core:jersey-server:jar:2.22.1:compile
[INFO] | +- org.glassfish.jersey.core:jersey-common:jar:2.22.1:compile
[INFO] | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.22.1:compile
[INFO] | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | +- org.glassfish.jersey.core:jersey-client:jar:2.22.1:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.22.1:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | +- org.glassfish.hk2:hk2-api:jar:2.4.0-b31:compile
[INFO] | | +- org.glassfish.hk2:hk2-utils:jar:2.4.0-b31:compile
[INFO] | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.4.0-b31:compile
[INFO] | +- org.glassfish.hk2.external:javax.inject:jar:2.4.0-b31:compile
[INFO] | +- org.glassfish.hk2:hk2-locator:jar:2.4.0-b31:compile
[INFO] | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.22.1:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-multipart:jar:2.22.1:compile
[INFO] | \- org.jvnet.mimepull:mimepull:jar:1.9.6:compile
[INFO] +- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.22.1:compile
[INFO] | +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.22.1:compile
[INFO] | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.5.4:compile
[INFO] | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.5.4:compile
[INFO] | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.5.4:compile
[INFO] +- org.glassfish.jersey.containers:jersey-container-jetty-http:jar:2.22.1:compile
[INFO] | \- org.eclipse.jetty:jetty-continuation:jar:9.1.1.v20140108:compile
[INFO] +- org.reflections:reflections:jar:0.9.10:compile
[INFO] | +- com.google.guava:guava:jar:15.0:compile
[INFO] | +- org.javassist:javassist:jar:3.19.0-GA:compile
[INFO] | \- com.google.code.findbugs:annotations:jar:2.0.1:compile
[INFO] +- com.jcraft:jsch:jar:0.1.53:compile
[INFO] +- ie.corballis:sox-java:jar:1.0.1:compile
[INFO] +- com.sun.mail:javax.mail:jar:1.5.0:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.springframework:spring-web:jar:5.3.0:compile
[INFO] | +- org.springframework:spring-beans:jar:5.3.0:compile
[INFO] | \- org.springframework:spring-core:jar:5.3.0:compile
[INFO] | \- org.springframework:spring-jcl:jar:5.3.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.3:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.11.3:compile
[INFO] +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.3:compile
[INFO] +- javax.servlet.jsp.jstl:jstl-api:jar:1.2:compile
[INFO] | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | \- javax.servlet.jsp:jsp-api:jar:2.1:compile
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] \- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.017 s
[INFO] Finished at: 2022-08-24T16:49:34+02:00
[INFO] ------------------------------------------------------------------------
EDIT: after reading many, many SO posts about exactly this exception I changed to the Apache artifacts, but this changes nothing, the exact same exception except for the string "PWC6188" which disappears if I use the Apache artifacts
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jsp</artifactId>
<version>9.2.23.v20171218</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>apache-jstl</artifactId>
<version>9.2.23.v20171218</version>
</dependency>
iso
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jsp</artifactId>
<version>9.2.23.v20171218</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
The rest of the exception text remains the same for the Apache-JSP artifacts, the line numbers just change in the stack trace.