运行springboot应用程序时出现whitelabel错误页面 [英] Getting whitelabel error page when running springboot application

查看:51
本文介绍了运行springboot应用程序时出现whitelabel错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 ide 运行我的 springboot 应用程序时,它工作正常.

When i am running my springboot application by using ide it is working fine.

但是当我运行它的 jar 时,我得到了 Whitelabel 错误页面.

But when i am running it's jar i am getting Whitelabel Error Page.

白标错误页面

此应用程序没有显式映射/error,因此您将其视为后备.

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

2018 年 10 月 9 日星期二 15:42:47 IST出现意外错误(类型=未找到,状态=404)./WEB-INF/views/index.jsp

Tue Oct 09 15:42:47 IST 2018 There was an unexpected error (type=Not Found, status=404). /WEB-INF/views/index.jsp

<?xml version="1.0"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <modelVersion>4.0.0</modelVersion>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.onap.sdnc.oam.vnfbackup</groupId>
        <artifactId>configbackuprestore</artifactId>
        <version>1.4.0-SNAPSHOT</version>
    </parent>

    <groupId>org.onap.sdnc.oam.vnfbackup</groupId>
    <artifactId>vnfconfigbackupservice</artifactId>
    <version>1.4.0-SNAPSHOT</version>
    <name>sdnc-oam :: vnfbackup :: vnfconfigbackupservice</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.onap.sdnc.oam.vnfbackup</groupId>
            <artifactId>getBackupVnfDetailService</artifactId>
            <version>1.4.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.onap.sdnc.oam.vnfbackup</groupId>
            <artifactId>vnfconfigreportsservice</artifactId>
            <version>1.4.0-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.jmockit</groupId>
            <artifactId>jmockit</artifactId>
            <version>1.19</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jmockit</groupId>
            <artifactId>jmockit-coverage</artifactId>
            <version>1.19</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.9</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>ch.vorburger.mariaDB4j</groupId>
            <artifactId>mariaDB4j</artifactId>
            <version>2.2.3</version>
        </dependency>

        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>1.1.9</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.5.4.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>4.3.9.RELEASE</version>
        </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>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <version>1.5.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <!-- Add Log4j2 Dependency -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>

        <!-- <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency> -->

        <dependency>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
            <version>4.6.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- Optional, test for static content, bootstrap CSS-->
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7</version>
        </dependency>


    </dependencies>

    <build>
        <plugins>

            <!-- <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifest>
                <addClasspath>true</addClasspath>
                <mainClass>com.onap.sdnc.vnfbackupservice.config.ApplicationConfiguration</mainClass>
                <classpathPrefix>dependency-jars/</classpathPrefix>
                </manifest>
              </archive>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-dependencies</id>
                <phase>package</phase>
                <goals>
                    <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                    <outputDirectory>
                                  ${project.build.directory}/dependency-jars/
                            </outputDirectory>
                </configuration>
                </execution>
            </executions>
            </plugin> -->

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.21.0</version>
                <configuration>
                    <argLine>-XX:+StartAttachListener</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

application.properties

server.port = 9009

spring.mvc.view.prefix = /WEB-INF/views/
spring.mvc.view.suffix = .jsp

推荐答案

我得到了解决方案,如果我们需要运行那个 jar,那么我们需要从项目目录运行它,这样它就会找到 webapp 文件夹 eg-example>java -jar target/example-1.0-snapshot-.jar 或者我们需要将其作为战争并运行 java -jar example-1.0-snapshot-.war.

I got the solution if we need to run that jar then we need to run that from project directory so it will find the webapp folder e.g-example>java -jar target/example-1.0-snapshot-.jar or we need to make that as a war and run java -jar example-1.0-snapshot-.war.

这篇关于运行springboot应用程序时出现whitelabel错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆