spring boot jsp:java.lang.NoClassDefFoundError:org / apache / tomcat / util / security / Escape(示例代码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring boot jsp:java.lang.NoClassDefFoundError:org / apache / tomcat / util / security / Escape(示例代码相关的知识,希望对你有一定的参考价值。
我试图在我的春季启动应用程序中添加一个简单的jsp渲染。
@Controller
public class WelcomeController {
@RequestMapping("/index")
public String loginMessage(){
return "index";
}
}
解决
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
和/src/main/webapp/WEB-INF/jsp/index.jsp
我添加了spring boot web starter和tomcat embed
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.apache.tomcat.embed:tomcat-embed-jasper')
我正面临这个问题
May 11, 2018 3:54:53 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [java.lang.NoClassDefFoundError: org/apache/tomcat/util/security/Escape] with root cause
java.lang.ClassNotFoundException: org.apache.tomcat.util.security.Escape
答案
我通过使用compileOnly修复了这个问题
compile('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.apache.tomcat.embed:tomcat-embed-jasper')
仅编译类似于maven中提供的范围。
以上是关于spring boot jsp:java.lang.NoClassDefFoundError:org / apache / tomcat / util / security / Escape(示例代码的主要内容,如果未能解决你的问题,请参考以下文章