【发布时间】:2020-11-19 15:08:04
【问题描述】:
我正在尝试将 Spring Boot 从版本 2.1.x 升级到 2.2.x,但在我的 jsp 文件中包含 jstl 时不断遇到问题。
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 文件,但我有一个 web.config 文件,我们在 Azure 中部署时使用该文件。但这在本地测试时不应该是相关的......
关于如何解决此问题的任何想法?当我在发行说明中找不到任何与 jsp 或 jstl 相关的重大更改时,为什么 Spring Boot 2.2.x 会破坏这一点?
【问题讨论】:
标签: java spring-boot jstl