WARN 3200 Path with WEB-INF or META-INF

A jsp page is added in spring boot application. When the jsp page is accessed in browser, it shows error 404, page can’t be found.

Exception

2019-10-03 13:17:57.140  WARN 3200 --- [nio-8080-exec-1] o.s.w.s.r.ResourceHttpRequestHandler     : Path with "WEB-INF" or "META-INF": [WEB-INF/jsp/helloworld.jsp]
 2019-10-03 13:17:57.154  WARN 3200 --- [nio-8080-exec-1] o.s.w.s.r.ResourceHttpRequestHandler     : Path with "WEB-INF" or "META-INF": [WEB-INF/jsp/error.jsp]


How to reproduce this issue

Follow the below steps to reproduce this issue. Configure jsp folder in application.properties file

spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp

Create a controller class as like below

package com.yawintutor;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloWorldController {

	@RequestMapping("/HelloWorld")
	public ModelAndView firstPage() {
		return new ModelAndView("helloworld");
	}

}

Add a helloworld.jsp file in src/main/webapp/WEB-INF/jsp/ folder.

src/main/webapp/WEB-INF/jsp/helloworld .jsp

<h1>Welcome to Hello World!</h1>

Open a browser and call the url as “http://localhost:8080/HelloWorld”. This url should invoke firstPage method in HelloWorldController class. The model view is configured with helloworld. the file in src/main/webapp/WEB-INF/jsp/helloworld.jsp should be rendered.



Root Cause

The jsp path resolving class is available in tomcat jasper package. The dependency of tomcat jasper is not added in pom.xml. So the jsp path is not resolved by spring boot application



Solution

The dependent jars are available in tomcat jasper. Add tomcat jasper dependency in pom.xml file

	<dependency>
		<groupId>org.apache.tomcat.embed</groupId>
		<artifactId>tomcat-embed-jasper</artifactId>
	</dependency>



Related Articles

4 Comments

  • JT , June 30, 2020 @ 6:18 PM

    Perfect, my code is now working, thank you!

  • Albert , April 4, 2020 @ 3:28 PM

    Thanks, works for me

  • Ram , December 24, 2019 @ 11:49 PM

    added everything as on the page, but the error is still 404

    • Yawin Tutor , December 28, 2019 @ 1:15 PM

      Hi Ram, Please share your code link

Leave a Reply

Your email address will not be published. Required fields are marked *