구리

[Spring boot] JSP 연동 오류 (java.lang.NoSuchMethodError) 본문

오류해결

[Spring boot] JSP 연동 오류 (java.lang.NoSuchMethodError)

guriguriguri 2021. 7. 20. 17:57

[문제 발생 상황]

인텔리제이에서 gradle, spring boot를 이용한 프로젝트를 생성하여 JSP 파일을 연동하려는 중 오류가 발생하였습니다.

참고로 프로젝트에도 JSP 관련된 디펜던시를 추가하였습니다. (jstl, tomcat-embed-jasper 추가)

// JSTL
implementation 'javax.servlet:jstl'
// JASPER
implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'

디펜던시 추가한 이유?

1. 스프링 부트에서는 기본적으로 JSP를 지원하지 않음

2. 스프링 부트에 내장된 tomcat에는 컴파일하는 jsp 관련 엔진이 포함되지 않음 

 

<프로젝트 구성>

<build.gradle>

plugins {
    id 'org.springframework.boot' version '2.4.8'
    id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    id 'java'
    id 'war'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    // JSTL
    implementation 'javax.servlet:jstl'
    // JASPER
    implementation 'org.apache.tomcat.embed:tomcat-embed-jasper'
//    compileOnly('org.apache.tomcat.embed:tomcat-embed-jasper')
//    compileOnly('javax.servlet:jstl:1.2')

}

test {
    useJUnitPlatform()
}

 

<application.properties>

server.port=9999

spring.mvc.view.prefix=/WEB-INF/views/
spring.mvc.view.suffix=.jsp

 

<TestController>

package com.example.bootstraptest.test;

        import org.springframework.stereotype.Controller;
        import org.springframework.web.bind.annotation.GetMapping;
        import org.springframework.web.bind.annotation.RequestMapping;
        import org.springframework.web.bind.annotation.RequestMethod;


@Controller
public class TestController {

    @RequestMapping(value="/test", method = RequestMethod.GET)
    public String hello(){
        System.out.println("controller start");
        return "index";
    }
}

 

<index.jsp>

<%--
  Created by IntelliJ IDEA.
  User: LG-PC
  Date: 2021-07-19
  Time: 오후 10:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    hello!
</body>
</html>

<BootstraptestApplication>

package com.example.bootstraptest;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@SpringBootApplication
public class BootstraptestApplication {

    public static void main(String[] args) {
        SpringApplication.run(BootstraptestApplication.class, args);
    }
}

테스트용으로 TestController 생성 후 src/main 하위에 디렉토리 설정 후 index.jsp를 생성하여 BootstraptestApplication 클래스를 run 하고 브라우저 url에 http://localhost:9999/test 를 호출하니 오류가 발생하였습니다.

 

[ 콘솔창의 오류 메세지 ]

c:\jdk1.8\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=56319:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath C:\jdk1.8\jre\lib\charsets.jar;C:\jdk1.8\jre\lib\deploy.jar;C:\jdk1.8\jre\lib\ext\access-bridge-64.jar;C:\jdk1.8\jre\lib\ext\cldrdata.jar;C:\jdk1.8\jre\lib\ext\dnsns.jar;C:\jdk1.8\jre\lib\ext\el-api.jar;C:\jdk1.8\jre\lib\ext\jaccess.jar;C:\jdk1.8\jre\lib\ext\jfxrt.jar;C:\jdk1.8\jre\lib\ext\jsp-api.jar;C:\jdk1.8\jre\lib\ext\localedata.jar;C:\jdk1.8\jre\lib\ext\nashorn.jar;C:\jdk1.8\jre\lib\ext\ojdbc8.jar;C:\jdk1.8\jre\lib\ext\servlet-api.jar;C:\jdk1.8\jre\lib\ext\sunec.jar;C:\jdk1.8\jre\lib\ext\sunjce_provider.jar;C:\jdk1.8\jre\lib\ext\sunmscapi.jar;C:\jdk1.8\jre\lib\ext\sunpkcs11.jar;C:\jdk1.8\jre\lib\ext\zipfs.jar;C:\jdk1.8\jre\lib\javaws.jar;C:\jdk1.8\jre\lib\jce.jar;C:\jdk1.8\jre\lib\jfr.jar;C:\jdk1.8\jre\lib\jfxswt.jar;C:\jdk1.8\jre\lib\jsse.jar;C:\jdk1.8\jre\lib\management-agent.jar;C:\jdk1.8\jre\lib\plugin.jar;C:\jdk1.8\jre\lib\resources.jar;C:\jdk1.8\jre\lib\rt.jar;C:\IntelliJ_spring_boot\bootstraptest\build\classes\java\main;C:\IntelliJ_spring_boot\bootstraptest\build\resources\main;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.projectlombok\lombok\1.18.20\18bcea7d5df4d49227b4a0743a536208ce4825bb\lombok-1.18.20.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.4.8\4dee55ce0cf00681ab991e946f28e0ba858d552a\spring-boot-starter-web-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\javax.servlet\jstl\1.2\74aca283cd4f4b4f3e425f5820cda58f44409547\jstl-1.2.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-jasper\9.0.48\af2eea663d8926a61cfbc396f1e51d004623365c\tomcat-embed-jasper-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.4.8\d2e6eb33b190947c7b23cd3277ace97d388c08ce\spring-boot-starter-tomcat-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.4.8\c0f1ce32d74184eef898ae2fe54c7bcf01d27656\spring-boot-starter-json-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.4.8\43a123a87c5376f6d89908b8df09a202ca519a6e\spring-boot-starter-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.3.8\2cfa5e12bf103e2c82db78ce198e455dab456465\spring-webmvc-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.3.8\daa288e67b0f2e09a033500d5ce8406677c5045c\spring-web-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.48\f112cd2380d8215e22ac40aff128a1b6daa2f0ac\tomcat-embed-core-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\9.0.48\c46a092831493ccf65674cb19235625853ceb3d4\tomcat-embed-el-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.eclipse.jdt\ecj\3.18.0\4d5d0911b30db24c8eb844702c8adf8e434314ff\ecj-3.18.0.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.48\a34e3133ec3d61f4c2faa30476c4b43cc6385dd6\tomcat-embed-websocket-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.glassfish\jakarta.el\3.0.3\dab46ee1ee23f7197c13d7c40fce14817c9017df\jakarta.el-3.0.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.11.4\e1540dea3c6c681ea4e335a960f730861ee3bedb\jackson-datatype-jdk8-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.4\ce6fc76bba06623720e5a9308386b6ae74753f4d\jackson-datatype-jsr310-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.11.4\432e050d79f2282a66c320375d628f1b0842cb12\jackson-module-parameter-names-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.4\5d9f3d441f99d721b957e3497f0a6465c764fad4\jackson-databind-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.4.8\560a2ce88bfdeac25376a0083efd6a2a493c3ba\spring-boot-autoconfigure-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.4.8\6e6c5c46325a6f68492d0097bd6c5269006953a1\spring-boot-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.4.8\6af7bda1ad0789239c9b4ab0b517e6dfaa0ef139\spring-boot-starter-logging-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.3.8\da9b87dacaa5bbf80fad0f7b483988372a00a152\spring-core-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.27\359d62567480b07a679dc643f82fc926b100eed5\snakeyaml-1.27.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.3.8\c367a05423e963c222e38a6a88b97d44de3880ca\spring-context-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.3.8\1377f80f938b1fc7eabe9e6c4f6895e77e3bec40\spring-aop-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.3.8\3d66fed1eebfcd119efcabc6218c813700a21ed\spring-beans-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.3.8\8a14547b76cbae3aeb02739e5b38e71835a6bbd8\spring-expression-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat\tomcat-annotations-api\9.0.48\2964e407c8e0b37d0b7f3e3c306142383ff1440b\tomcat-annotations-api-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.11.4\593f7b18bab07a76767f181e2a2336135ce82cc4\jackson-core-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.11.4\2c3f5c079330f3a01726686a078979420f547ae4\jackson-annotations-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.13.3\966f6fd1af4959d6b12bfa880121d4a2b164f857\log4j-to-slf4j-2.13.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.31\f9ff62d83a25a94c1619de06d4015e2797bc849c\jul-to-slf4j-1.7.31.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.3.8\a143c8618eb2be8674c3cf132d9a5c953bb5488\spring-jcl-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.31\9545c9cb71de4c18d97a91e32ef0be6f3f6661b7\slf4j-api-1.7.31.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.13.3\ec1508160b93d274b1add34419b897bae84c6ca9\log4j-api-2.13.3.jar com.example.bootstraptest.BootstraptestApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.8)

2021-07-20 10:32:34.381  INFO 18108 --- [           main] c.e.b.BootstraptestApplication           : Starting BootstraptestApplication using Java 1.8.0_251 on DESKTOP-506I4I4 with PID 18108 (C:\IntelliJ_spring_boot\bootstraptest\build\classes\java\main started by LG-PC in C:\IntelliJ_spring_boot\bootstraptest)
2021-07-20 10:32:34.392  INFO 18108 --- [           main] c.e.b.BootstraptestApplication           : No active profile set, falling back to default profiles: default
2021-07-20 10:32:38.759  INFO 18108 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9090 (http)
2021-07-20 10:32:38.808  INFO 18108 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-07-20 10:32:38.809  INFO 18108 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.48]
2021-07-20 10:32:39.304  WARN 18108 --- [           main] o.a.t.util.descriptor.DigesterFactory    : The XML schema [web-app_4_0.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled.
2021-07-20 10:32:39.305  WARN 18108 --- [           main] o.a.t.util.descriptor.DigesterFactory    : The XML schema [web-fragment_4_0.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled.
2021-07-20 10:32:39.306  WARN 18108 --- [           main] o.a.t.util.descriptor.DigesterFactory    : The XML schema [web-common_4_0.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled.
2021-07-20 10:32:39.307  WARN 18108 --- [           main] o.a.t.util.descriptor.DigesterFactory    : The XML schema [javaee_8.xsd] could not be found. This is very likely to break XML validation if XML validation is enabled.
2021-07-20 10:32:40.041  INFO 18108 --- [           main] org.apache.jasper.servlet.TldScanner     : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2021-07-20 10:32:40.063  INFO 18108 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-07-20 10:32:40.064  INFO 18108 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5435 ms
2021-07-20 10:32:41.331  INFO 18108 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9090 (http) with context path ''
2021-07-20 10:32:41.391  INFO 18108 --- [           main] c.e.b.BootstraptestApplication           : Started BootstraptestApplication in 8.887 seconds (JVM running for 16.381)
2021-07-20 10:32:41.566  INFO 18108 --- [nio-9090-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-07-20 10:32:41.566  INFO 18108 --- [nio-9090-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-07-20 10:32:41.567  INFO 18108 --- [nio-9090-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
controller start
2021-07-20 10:32:41.712 ERROR 18108 --- [nio-9090-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;] with root cause

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
	at org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:714) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationHttpRequest.<init>(ApplicationHttpRequest.java:113) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:920) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:359) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:171) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1396) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1141) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) ~[servlet-api.jar:na]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.8.jar:5.3.8]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[servlet-api.jar:na]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.8.jar:5.3.8]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar:5.3.8]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.8.jar:5.3.8]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar:5.3.8]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.8.jar:5.3.8]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.3.8.jar:5.3.8]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_251]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_251]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_251]

2021-07-20 10:32:41.714 ERROR 18108 --- [nio-9090-exec-1] o.a.c.c.C.[Tomcat].[localhost]           : Exception Processing ErrorPage[errorCode=0, location=/error]

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
	at org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:714) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationHttpRequest.<init>(ApplicationHttpRequest.java:113) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:920) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:359) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:313) ~[tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:398) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:257) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:352) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_251]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_251]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.48.jar:9.0.48]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_251]


Process finished with exit code -1

 

[ 원인 ]

구글링 결과 완벽하게는 아니지만 내장된 톰캣의 일부 api.jar 파일들과 자바의 ~~-api.jar 파일들의 버전이 상이하여 충돌하여 발생한듯 하였습니다.

또한 오류 메세지를 보면 중간에 [servlet-api.jar:na] 라고 나와있는데 servlet-api.jar 에만 버전이 나와있지 않는 것을 볼 수 있습니다.

 

[ 해결 방법 ]

따라서 톰캣 (버전 9.0~~) 의 라이브러리를 다운받은 후 servlet-api.jar, el-api.jar 파일을 설치된 자바 경로에 들어가 덮어씌우기를 해주면 됩니다. (필자의 경우 자바 경로 : C:\jdk1.8\jre\lib\ext)

 

덮어씌우기를 마친 후 프로젝트를 실행하면 정상적인 jsp 파일이 출력되는 것을 볼 수 있습니다.

 

<콘솔창 정상 실행 결과>

c:\jdk1.8\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\lib\idea_rt.jar=54698:C:\Program Files\JetBrains\IntelliJ IDEA 2021.1.3\bin" -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath C:\jdk1.8\jre\lib\charsets.jar;C:\jdk1.8\jre\lib\deploy.jar;C:\jdk1.8\jre\lib\ext\access-bridge-64.jar;C:\jdk1.8\jre\lib\ext\cldrdata.jar;C:\jdk1.8\jre\lib\ext\dnsns.jar;C:\jdk1.8\jre\lib\ext\el-api.jar;C:\jdk1.8\jre\lib\ext\jaccess.jar;C:\jdk1.8\jre\lib\ext\jfxrt.jar;C:\jdk1.8\jre\lib\ext\jsp-api.jar;C:\jdk1.8\jre\lib\ext\localedata.jar;C:\jdk1.8\jre\lib\ext\nashorn.jar;C:\jdk1.8\jre\lib\ext\ojdbc8.jar;C:\jdk1.8\jre\lib\ext\servlet-api.jar;C:\jdk1.8\jre\lib\ext\sunec.jar;C:\jdk1.8\jre\lib\ext\sunjce_provider.jar;C:\jdk1.8\jre\lib\ext\sunmscapi.jar;C:\jdk1.8\jre\lib\ext\sunpkcs11.jar;C:\jdk1.8\jre\lib\ext\zipfs.jar;C:\jdk1.8\jre\lib\javaws.jar;C:\jdk1.8\jre\lib\jce.jar;C:\jdk1.8\jre\lib\jfr.jar;C:\jdk1.8\jre\lib\jfxswt.jar;C:\jdk1.8\jre\lib\jsse.jar;C:\jdk1.8\jre\lib\management-agent.jar;C:\jdk1.8\jre\lib\plugin.jar;C:\jdk1.8\jre\lib\resources.jar;C:\jdk1.8\jre\lib\rt.jar;C:\IntelliJ_spring_boot\bootstraptest\out\production\classes;C:\IntelliJ_spring_boot\bootstraptest\out\production\resources;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.projectlombok\lombok\1.18.20\18bcea7d5df4d49227b4a0743a536208ce4825bb\lombok-1.18.20.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-web\2.4.8\4dee55ce0cf00681ab991e946f28e0ba858d552a\spring-boot-starter-web-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\javax.servlet\jstl\1.2\74aca283cd4f4b4f3e425f5820cda58f44409547\jstl-1.2.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-jasper\9.0.48\af2eea663d8926a61cfbc396f1e51d004623365c\tomcat-embed-jasper-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-tomcat\2.4.8\d2e6eb33b190947c7b23cd3277ace97d388c08ce\spring-boot-starter-tomcat-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-json\2.4.8\c0f1ce32d74184eef898ae2fe54c7bcf01d27656\spring-boot-starter-json-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter\2.4.8\43a123a87c5376f6d89908b8df09a202ca519a6e\spring-boot-starter-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-webmvc\5.3.8\2cfa5e12bf103e2c82db78ce198e455dab456465\spring-webmvc-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-web\5.3.8\daa288e67b0f2e09a033500d5ce8406677c5045c\spring-web-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-core\9.0.48\f112cd2380d8215e22ac40aff128a1b6daa2f0ac\tomcat-embed-core-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-el\9.0.48\c46a092831493ccf65674cb19235625853ceb3d4\tomcat-embed-el-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.eclipse.jdt\ecj\3.18.0\4d5d0911b30db24c8eb844702c8adf8e434314ff\ecj-3.18.0.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat.embed\tomcat-embed-websocket\9.0.48\a34e3133ec3d61f4c2faa30476c4b43cc6385dd6\tomcat-embed-websocket-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\jakarta.annotation\jakarta.annotation-api\1.3.5\59eb84ee0d616332ff44aba065f3888cf002cd2d\jakarta.annotation-api-1.3.5.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.glassfish\jakarta.el\3.0.3\dab46ee1ee23f7197c13d7c40fce14817c9017df\jakarta.el-3.0.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.11.4\e1540dea3c6c681ea4e335a960f730861ee3bedb\jackson-datatype-jdk8-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.4\ce6fc76bba06623720e5a9308386b6ae74753f4d\jackson-datatype-jsr310-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-parameter-names\2.11.4\432e050d79f2282a66c320375d628f1b0842cb12\jackson-module-parameter-names-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.4\5d9f3d441f99d721b957e3497f0a6465c764fad4\jackson-databind-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-autoconfigure\2.4.8\560a2ce88bfdeac25376a0083efd6a2a493c3ba\spring-boot-autoconfigure-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot\2.4.8\6e6c5c46325a6f68492d0097bd6c5269006953a1\spring-boot-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework.boot\spring-boot-starter-logging\2.4.8\6af7bda1ad0789239c9b4ab0b517e6dfaa0ef139\spring-boot-starter-logging-2.4.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-core\5.3.8\da9b87dacaa5bbf80fad0f7b483988372a00a152\spring-core-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.27\359d62567480b07a679dc643f82fc926b100eed5\snakeyaml-1.27.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-context\5.3.8\c367a05423e963c222e38a6a88b97d44de3880ca\spring-context-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-aop\5.3.8\1377f80f938b1fc7eabe9e6c4f6895e77e3bec40\spring-aop-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-beans\5.3.8\3d66fed1eebfcd119efcabc6218c813700a21ed\spring-beans-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-expression\5.3.8\8a14547b76cbae3aeb02739e5b38e71835a6bbd8\spring-expression-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.tomcat\tomcat-annotations-api\9.0.48\2964e407c8e0b37d0b7f3e3c306142383ff1440b\tomcat-annotations-api-9.0.48.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.11.4\593f7b18bab07a76767f181e2a2336135ce82cc4\jackson-core-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.11.4\2c3f5c079330f3a01726686a078979420f547ae4\jackson-annotations-2.11.4.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-to-slf4j\2.13.3\966f6fd1af4959d6b12bfa880121d4a2b164f857\log4j-to-slf4j-2.13.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.slf4j\jul-to-slf4j\1.7.31\f9ff62d83a25a94c1619de06d4015e2797bc849c\jul-to-slf4j-1.7.31.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.springframework\spring-jcl\5.3.8\a143c8618eb2be8674c3cf132d9a5c953bb5488\spring-jcl-5.3.8.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.31\9545c9cb71de4c18d97a91e32ef0be6f3f6661b7\slf4j-api-1.7.31.jar;C:\Users\LG-PC\.gradle\caches\modules-2\files-2.1\org.apache.logging.log4j\log4j-api\2.13.3\ec1508160b93d274b1add34419b897bae84c6ca9\log4j-api-2.13.3.jar com.example.bootstraptest.BootstraptestApplication

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.4.8)

2021-07-20 17:44:53.475  INFO 12892 --- [           main] c.e.b.BootstraptestApplication           : Starting BootstraptestApplication using Java 1.8.0_251 on DESKTOP-506I4I4 with PID 12892 (C:\IntelliJ_spring_boot\bootstraptest\out\production\classes started by LG-PC in C:\IntelliJ_spring_boot\bootstraptest)
2021-07-20 17:44:53.494  INFO 12892 --- [           main] c.e.b.BootstraptestApplication           : No active profile set, falling back to default profiles: default
2021-07-20 17:44:57.164  INFO 12892 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 9999 (http)
2021-07-20 17:44:57.242  INFO 12892 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-07-20 17:44:57.243  INFO 12892 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.48]
2021-07-20 17:44:58.206  INFO 12892 --- [           main] org.apache.jasper.servlet.TldScanner     : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2021-07-20 17:44:58.218  INFO 12892 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-07-20 17:44:58.218  INFO 12892 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4461 ms
2021-07-20 17:44:58.927  INFO 12892 --- [           main] o.s.b.a.w.s.WelcomePageHandlerMapping    : Adding welcome page template: index
2021-07-20 17:44:59.488  INFO 12892 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 9999 (http) with context path ''
2021-07-20 17:44:59.526  INFO 12892 --- [           main] c.e.b.BootstraptestApplication           : Started BootstraptestApplication in 9.894 seconds (JVM running for 16.863)
2021-07-20 17:45:32.703  INFO 12892 --- [nio-9999-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-07-20 17:45:32.703  INFO 12892 --- [nio-9999-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2021-07-20 17:45:32.705  INFO 12892 --- [nio-9999-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms
controller start

Process finished with exit code -1

< 브라우저 화면 >