sırasında aşağıdaki Whitelabel Hata Sayfası'nı alıyorum Spring Boot MVC uygulamasını çalıştırıyorum.Yay önyükleme MVC: Whitelabel Hata Sayfası
Whitelabel Hata Sayfası
Bu uygulama/hata için hiçbir açık bir eşleme vardır, bu nedenle son çare olarak bu görüyoruz.
Çar Nis 13 15:45:59 IST 2016 Beklenmeyen bir hata oluştu (type = Dahili Sunucu Hatası, durum = 500). Dairesel izleme yolu [home]: tekrar geçerli işleyici URL'sine [/ rewards/web/home] geri gönderilir. ViewResolver kurulumunuzu kontrol edin! (Ipucu. Bu durum, varsayılan görünüm adı nesil, belirtilmeyen bir bakış sonucu olabilir)
application.properties
server.contextPath=/rewards/web
rewardsweb-servlet.xml:
<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">
<context:component-scan base-package="com.rewards.web" />
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/views/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<mvc:resources mapping="/resources/**" location="/resources/" />
<mvc:annotation-driven />
</beans>
web.xml
<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">
<display-name>rewards-web</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>rewardsweb</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rewardsweb</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
Bahar Boot dosyaları
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;
}
}
Denetleyici:
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";
}
}
JSP
home.jsp is in this path : /src/main/webapp/WEB-INF/views/jsp/home.jsp
i çarptı: http://localhost:9090/rewards/web/home Whitelabel Hatası
'u alıyorum ve ayrıca aşağıdaki çözümü denedim, denetleyici sınıfında aşağıdaki kodu ekledim. ama yardım yok.
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";
}
}
Lütfen bana yardımcı olabilir misiniz?
Teşekkürler.