goorm 스프링부트 gradle WEB_002dINF 오류 해결이 안됩니다
goorm IDE 환경에서 공부하고 있는데요
JAVA에서 데이터를 jsp로 넘기려고 ModelAndView를 사용하는데 jsp에 데이터를 받는 ${name} 부분이 있으면 WEB_002dINF 오류가 발생합니다. maven 해결방법은 많이 있는데 gradle로 해서 어떻게 해야할지를 모르겠어서 글을 적게 되었습니다
error message
gradle bootRun
https://restapi-windz.run.goorm.io
W
2020-07-02 01:38:49.998 ERROR 1276 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exce
ption [java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.boardList_jsp] with root cause
java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.boardList_jsp
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_111]
java
@RequestMapping(value="/boardList")
public ModelAndView boardList( ){
ModelAndView mv = new ModelAndView();
mv.addObject("name","홍길동");
mv.setViewName("/boardList");
return mv;
//return new ModelAndView("boardWrite");
}
jsp
게시글 리스트
번호 |
제목 |
작성자 |
작성일 |
${name} |
---|
build.gradle
group 'io.goorm'
version '0.0.1'
apply plugin: 'java'
sourceCompatibility = 1.8
buildscript{
//전역변수 선언
ext{
springBootVersion = '2.1.7.RELEASE'
}
repositories{
maven{
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
jcenter()
}
dependencies{
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-hateoas'
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.5.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.5.0'
testCompile 'org.springframework.boot:spring-boot-starter-test'
testCompile group: 'junit', name: 'junit', version: '4.12'
// 데이터베이스연동
compile 'org.slf4j:slf4j-api:1.7.7'
compile group: 'org.hsqldb', name:'hsqldb', version:'2.3.2'
compile "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
compile group: 'org.hibernate', name:'hibernate-validator', version:'5.1.3.Final'
compile 'mysql:mysql-connector-java'
//웹기반 디바이스에서 데이터 연동
compile group: 'javax.el', name:'javax.el-api',version:'3.0.0'
compile group: 'javax.validation',name:'validation-api',version:'1.1.0.Final'
compile 'javax.servlet:jstl'
compile 'org.apache.tomcat.embed:tomcat-embed-jasper'
compile group:'org.glassfish.web',name:'el-impl',version:'2.2'
compile 'javax.inject:javax.inject:1'
compile "com.google.dagger:dagger:2.8"
annotationProcessor "com.google.dagger:dagger-compiler:2.8"
}
def webappDir = '$rootDir/src/main/webapp'
jar {
manifest {
attributes 'Main-Class': 'project.Main'
}
}
dependencies에 아래와 같이 servlet-api 추가가 필요할 것 같습니다.