0

I'm using Spring Boot and running the webapp on the embedded Tomcat server

I got this error: "o.s.w.s.r.ResourceHttpRequestHandler : "Path with "WEB-INF" or "META-INF": [static/WEB-INF/views/loginPage.html]""

Here's my controller:

@Controller
public class GreetingsController {

    @GetMapping(value = "/")
    public String greetingText() {
        return "loginPage";
    }
}

application.properties:

server.address=0.0.0.0
server.port=8080
    
spring.mvc.view.prefix= /static/WEB-INF/views/
spring.mvc.view.suffix=.html

Project structure:

enter image description here

  • webapp folder is empty

I'm confident that I have most necessary dependencies installed (Jasper, Spring Boot, Thymeleaf,..). I have done a good amount of searching on my own

Please do note that I have also tried moving the WEB-INF folder to the webapp and changing the view prefix accordingly, however, it did not come to fruition

Shadow
  • 57
  • 4

1 Answers1

1

Short answer: Don't store your files in the WEB-INF directory.

Note the part in bold below.

From the Servlet 2.4 Spec: The WEB-INF node is not part of the public document tree of the application. No file contained in the WEB-INF directory may be served directly to a client by the container.

This is an excerpt from: What is WEB-INF used for in a Java EE web application?

DwB
  • 37,124
  • 11
  • 56
  • 82