admin管理员组文章数量:1193346
I have JSTL, Tomcat application setup. Recently migrated application to servlet 6.0.0 & Tomcat 10.1.34 (From 9.0.20).
I followed the steps given in answer to this Post - How to install JSTL? It fails with "The absolute uri cannot be resolved" or "Unable to find taglib" or NoClassDefFoundError or ClassCastException
My application started working after that with standalone tomcat server loading all JSPs.
However when I tried running my application by deploying the same War files inside docker container its giving FileNotFoundException.
Exception stackstrace below -
org.spr.web.ser.DispatcherServlet] - Error rendering view [org.springframework.web.servlet.view.JstlView: name [app/app_main]; URL [/WEB-INF/jsp/app/app_main.jsp]]
org.apache.jasper.JasperException: Unable to get JAR resource [/WEB-INF/jsp/app/jakarta.tags.core] containing TLD: [java.io.FileNotFoundException]
at org.apache.jasperpiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:37) ~[jasper.jar:10.1.34]
at org.apache.jasperpiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:270) ~[jasper.jar:10.1.34]
at org.apache.jasperpiler.ErrorDispatcher.jspError(ErrorDispatcher.java:77) ~[jasper.jar:10.1.34]
at org.apache.jasperpiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:284) ~[jasper.jar:10.1.34]
at org.apache.jasperpiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:124) ~[jasper.jar:10.1.34]
I have below dependencies in my application -
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
Tomcat Docker Image - tomcat:10.1.34-jdk17 All Tomcat jar versions - 10.1.34 JDK Docker Image - azul/zulu-openjdk-alpine:17.0.12-17.52
Spring - 6.1.14
Snapshot of one of my JSPs -
<%@taglib prefix="c" uri="jakarta.tags.core"%>
<%@taglib prefix="fn" uri="jakarta.tags.functions"%>
<!DOCTYPE html>
<html>
....
</html>
I tried the same versions of jars on my local Tomcat standalone server (10.1.34 version) and zulu-17, which worked with the steps to migrated to Jakarta namespace mentioned in below stackoverflow POST -
How to install JSTL? It fails with "The absolute uri cannot be resolved" or "Unable to find taglib" or NoClassDefFoundError or ClassCastException
I checked all the versions, there are no other conflicting versions than the mentioned once.
I have JSTL, Tomcat application setup. Recently migrated application to servlet 6.0.0 & Tomcat 10.1.34 (From 9.0.20).
I followed the steps given in answer to this Post - How to install JSTL? It fails with "The absolute uri cannot be resolved" or "Unable to find taglib" or NoClassDefFoundError or ClassCastException
My application started working after that with standalone tomcat server loading all JSPs.
However when I tried running my application by deploying the same War files inside docker container its giving FileNotFoundException.
Exception stackstrace below -
org.spr.web.ser.DispatcherServlet] - Error rendering view [org.springframework.web.servlet.view.JstlView: name [app/app_main]; URL [/WEB-INF/jsp/app/app_main.jsp]]
org.apache.jasper.JasperException: Unable to get JAR resource [/WEB-INF/jsp/app/jakarta.tags.core] containing TLD: [java.io.FileNotFoundException]
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:37) ~[jasper.jar:10.1.34]
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:270) ~[jasper.jar:10.1.34]
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:77) ~[jasper.jar:10.1.34]
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTldResourcePath(TagLibraryInfoImpl.java:284) ~[jasper.jar:10.1.34]
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:124) ~[jasper.jar:10.1.34]
I have below dependencies in my application -
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
Tomcat Docker Image - tomcat:10.1.34-jdk17 All Tomcat jar versions - 10.1.34 JDK Docker Image - azul/zulu-openjdk-alpine:17.0.12-17.52
Spring - 6.1.14
Snapshot of one of my JSPs -
<%@taglib prefix="c" uri="jakarta.tags.core"%>
<%@taglib prefix="fn" uri="jakarta.tags.functions"%>
<!DOCTYPE html>
<html>
....
</html>
I tried the same versions of jars on my local Tomcat standalone server (10.1.34 version) and zulu-17, which worked with the steps to migrated to Jakarta namespace mentioned in below stackoverflow POST -
How to install JSTL? It fails with "The absolute uri cannot be resolved" or "Unable to find taglib" or NoClassDefFoundError or ClassCastException
I checked all the versions, there are no other conflicting versions than the mentioned once.
Share Improve this question edited Jan 24 at 13:00 juiK asked Jan 24 at 8:20 juiKjuiK 14 bronze badges 13- What if you leave Spring outside the equation and create a minimal reproducer project without any Spring dependencies and simply access the JSP page directly? By the way, Tomcat already provides JSP and EL out the box as well, so you should absolutely not provide them via the webapp. See also stackoverflow.com/q/65703840. – BalusC Commented Jan 24 at 12:12
- Thanks @BalusC Yes, I now have removed jakarta-el & jakarta.servlet.jsp-api as its by provided by Tomcat (updated the same in question as well). Still its the same. As I mentioned this whole setup is completely working fine with local tomcat server 10.1.34 with same war on my windows machine. Whereas when I run it on linux-alpine with mentioned docker images then somewhere its not getting the Jar file.? – juiK Commented Jan 24 at 13:16
- In the attached post, you mention that the "<scope> is explicitly set to provided" Is it the case for these libraries as well - jakarta.servlet.jsp.jstl:jakarta.servlet.jsp.jstl-api, org.glassfish.web:jakarta.servlet.jsp.jstl ?? – juiK Commented Jan 24 at 13:34
- 1) Tomcat doesn't provide JSTL out the box so you don't need <scope>provided</scope> on them. This is also explained in the given link. 2) Ah right, it's thus a Docker env specific problem? Still, what if you leave Spring outside the equation and create a minimal reproducer project without any Spring dependencies and simply access the JSP page directly? (as asked in 1st comment). – BalusC Commented Jan 24 at 13:35
- Sorry, I misunderstood #1, so for these two JSTL dependencies, provided scope can't be given. For #2, I will try to run the simple JSP based application to reproduce with same tomcat & zulu images. – juiK Commented Jan 24 at 13:45
1 Answer
Reset to default 0I solved my issue by updating tomcat/conf/catalina.properties file as below-
jarsToSkip=\
log4j-taglib*.jar,\
slf4j-taglib*.jar,\
taglibs-standard-jstlel-*.jar,\
taglibs-standard-impl-*.jar
jarsToScan=\
jakarta.servlet.jsp*.jar,jakarta.servlet.jsp.jstl-api*.jar,\
jakarta.servlet.jsp.jstl*.jar
I also deleted these default webapp.dists for example project as it contained taglibs older jars to avoid any conflicts-
webapps.dist/examples/WEB-INF/lib has taglibs-standard-impl-1.2.5-migrated-0.0.1.jar taglibs-standard-spec-1.2.5-migrated-0.0.1.jar
After this it started picking up the correct JSTL jars.
本文标签:
版权声明:本文标题:spring - Unable to get JAR resource [WEB-INFjspappjakarta.tags.core] containing TLD: [java.io.FileNotFoundException] - Stack Ove 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738437576a2086765.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论