ERROR 1045 --- [nio-8080-exec-8] o.s.boot.context.web.ErrorPageFilter

时间:2015-10-25 16:31:30

标签: java spring maven spring-boot

我正在为我的大学做一项任务,我想使用Spring Boot。我不使用数据库,只是一个虚假的数据类。

当我尝试访问" /"或我的索引页面我得到以下错误:

2015-10-25 14:10:41.113 ERROR 1045 --- [nio-8080-exec-8] osboot.context.web.ErrorPageFilter:无法转发到请求[/]的错误页面响应已经提交。因此,响应可能具有错误的状态代码。如果您的应用程序在WebSphere Application Server上运行,则可以通过将com.ibm.ws.webcontainer.invokeFlushAfterService设置为false来解决此问题

That is my file tree

我的主要课程:

@SpringBootApplication
public class Application extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }

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


 }
}

我的控制器类:

@Controller
public class IndexController {

@Value("${application.message:Hello World}")
private String message = "Hello World";

@RequestMapping(value="/")
public String index(Map<String, Object> model){

    model.put("message", message);
    return "index";
}

}

我的index.jsp

<%@ taglib prefix="spring" uri="http://www. springframework .org/tags"%>
<html>
<body>
    <br>
    <br>
    Message: ${message}
</body>
</html>

我的POM

    <modelVersion>4.0.0</modelVersion>
    <groupId>alocation-spring</groupId>
    <artifactId>alocation-spring</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>alocation-spring Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <finalName>alocation-spring</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <useSystemClassLoader>false</useSystemClassLoader>
                <logger name="org.springframework.boot.context.web.ErrorPageFilter">
                    <level value="OFF" />
                </logger>
            </configuration>
        </plugin>
    </plugins>
</build>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.7.RELEASE</version>
</parent>

谢谢!

0 个答案:

没有答案