Spring boot MVC : Whitelabel Error Page
<p>Getting the following Whitelabel Error Page while
I am running Spring Boot MVC app.</p>

<p>Whitelabel Error Page</p>

<p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p>

<p>Wed Apr 13 15:45:59 IST 2016
There was an unexpected error (type=Internal Server Error, status=500).
Circular view path [home]: would dispatch back to the current handler URL [/rewards/web/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)<br/></p>

<p><strong>application.properties</strong></p>

<pre><code>server.contextPath=/rewards/web
</code></pre>

<p><strong>rewardsweb-servlet.xml:</strong></p>

<pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;

    &lt;context:component-scan base-package="com.rewards.web" /&gt;

    &lt;bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
        &lt;property name="prefix"&gt;
            &lt;value&gt;/WEB-INF/views/jsp/&lt;/value&gt;
        &lt;/property&gt;
        &lt;property name="suffix"&gt;
            &lt;value&gt;.jsp&lt;/value&gt;
        &lt;/property&gt;
    &lt;/bean&gt;

    &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;

    &lt;mvc:annotation-driven /&gt;

&lt;/beans&gt;
</code></pre>

<p><strong>web.xml</strong></p>

<pre><code>&lt;web-app xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    version="2.5"&gt;

    &lt;display-name&gt;rewards-web&lt;/display-name&gt;
    &lt;welcome-file-list&gt;  
   &lt;welcome-file&gt;index.jsp&lt;/welcome-file&gt;  
  &lt;/welcome-file-list&gt;  
    &lt;servlet&gt;
        &lt;servlet-name&gt;rewardsweb&lt;/servlet-name&gt;
        &lt;servlet-class&gt;
                    org.springframework.web.servlet.DispatcherServlet
                &lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;

    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;rewardsweb&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;

&lt;/web-app&gt;
</code></pre>

<p>Spring Boot files</p>

<pre><code>package com.rewards.web;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.web.SpringBootServletInitializer;


@SpringBootApplication
public class Application extends SpringBootServletInitializer {

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

}

package com.rewards.web;

import io.undertow.Undertow.Builder;

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.embedded.undertow.UndertowBuilderCustomizer;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
public class ApplicationConfiguration {
    @Bean
    public UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() {
        UndertowEmbeddedServletContainerFactory factory = new UndertowEmbeddedServletContainerFactory();
        factory.addBuilderCustomizers(new UndertowBuilderCustomizer() {

            public void customize(Builder builder) {
                builder.addHttpListener(9090, "0.0.0.0");
            }

        });
        return factory;
    }
}
</code></pre>

<p><strong>Controller:</strong></p>

<pre><code>package com.rewards.web.controller;

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

@Controller
public class HomeController {

    @RequestMapping("/home")
    public String getHome(){
        System.out.println("-------this is home----------");
        return "home";
    }
}
</code></pre>

<p><strong>JSP</strong></p>

<pre><code>home.jsp is in this path : /src/main/webapp/WEB-INF/views/jsp/home.jsp
</code></pre>

<p>when i hit : <strong><a href="http://localhost:9090/rewards/web/home" rel="nofollow">http://localhost:9090/rewards/web/home</a></strong>
i am getting Whitelabel Error </p>

<p>And also i have tried following solution,  added the following code in controller class. but no help.</p>

<pre><code>package com.rewards.web.controller;

import org.springframework.boot.autoconfigure.web.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HomeController implements ErrorController{

    private static final String PATH = "/error";

    @RequestMapping(value = PATH)
    public String error() {
        return "Error handling";
    }

    public String getErrorPath() {
        return PATH;
    }

    @RequestMapping("/home")
    public String getHome(){
        System.out.println("-------this is home----------");
        return "home";
    }
}
</code></pre>

<p>Can you please help me out. <br/>
Thanks.</p>