Spring Boot – Unable to resolve Whitelabel Error Page

Please define method in your controller: You may define @RequestMapping(value = "/", method = RequestMethod.GET) or you may directly use @GetMapping

@Controller
public class LoginController {

    @GetMapping(path="/")
    public String login() {
        System.out.println("******************logging************************");
        return "login";
    }

}

there might be some more conflicts in your pom, like no need add tomcat dependency as its already embedded so below can be removed.

 <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

To enable support for JSP’s, add a dependency on tomcat-embed-jasper.

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

and after 2.x release no need to extend SpringBootServletInitializer so below should be sufficient to start.

@SpringBootApplication
public class WebApplication{


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

}

Leave a Comment