我正在尝试将Spring Boot从2.1.x版升级到2.2.x版,但是jsp文件中的jstl include总是出现问题。
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我的gradle设置中有以下依赖项
dependencies {
// Spring Boot
implementation 'org.springframework.boot:spring-boot-starter-web'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// Web
implementation 'javax.servlet:jstl:1.2'
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.40'在我的jsp文件中,我有以下内容:
<!DOCTYPE html>
<%@ page language="java" pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
<%@ page trimDirectiveWhitespaces="true" session="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>在使用Spring Boot版本2.1.x时,所有这些都可以正常工作,但一旦我使用2.2.x,它就会中断,并出现上述错误。
当我启动应用程序时,我在IntelliJ设置中使用此VM选项
-Dtomcat.util.scan.StandardJarScanFilter.jarsToScan=jstl*.jar,spring-webmvc*.jar我没有web.xml文件,但我有一个在Azure中部署时使用的web.config文件。但在本地测试时,这不应该是相关的。
关于如何解决这个问题,有什么想法吗?当我在发行说明中找不到任何与jsp或jstl相关的突破性更改时,为什么Spring Boot 2.2.x破坏了这一点?
发布于 2021-01-18 14:28:12
您要将应用程序部署到哪台服务器?如果您实际将其部署到Azure中的Tomcat服务器中,则应该将tomcat-embedded jasper依赖项标记为已提供
providedRuntime 'org.apache.tomcat.embed:tomcat-embed-jasper:9.0.40'https://stackoverflow.com/questions/64914415
复制相似问题