Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 404运行Jar[Spring Boot]时出错_Java_Spring_Maven_Spring Boot_Jar - Fatal编程技术网

Java 404运行Jar[Spring Boot]时出错

Java 404运行Jar[Spring Boot]时出错,java,spring,maven,spring-boot,jar,Java,Spring,Maven,Spring Boot,Jar,我被一个问题缠住了,不知道出了什么问题 我有一个多模块maven项目,使用SpringBoot。 我用的是STS,一切都很好。如果我运行应用程序,它将运行服务器,我的索引位于localhost:8080 但是,我想从中生成一个jar。所以,我使用的是mvn清洁安装。它在/target中生成一个jar。jar中的布局很好,包含源代码和。 然后,我用java-jarmyjar.jar运行我的jar。服务器运行正常,但当我试图访问该站点时,出现了404错误。它找不到视图 错误: Whitelabel

我被一个问题缠住了,不知道出了什么问题

我有一个多模块maven项目,使用SpringBoot。

我用的是STS,一切都很好。如果我运行应用程序,它将运行服务器,我的索引位于localhost:8080

但是,我想从中生成一个jar。所以,我使用的是mvn清洁安装。它在/target中生成一个jar。jar中的布局很好,包含源代码和。 然后,我用java-jarmyjar.jar运行我的jar。服务器运行正常,但当我试图访问该站点时,出现了404错误。它找不到视图

错误:

Whitelabel Error Page

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

Wed Dec 28 19:45:52 CET 2016
There was an unexpected error (type=Not Found, status=404).
No message available
下面是我的web和客户端模块的pom.xml

客户端pom.xml

   <?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>
      <parent>
        <groupId>projet.si</groupId>
        <artifactId>projetsi</artifactId>
        <version>0.0.1-SNAPSHOT</version>
      </parent>

      <groupId>projet.si</groupId>
      <artifactId>ProjetSI_client</artifactId>
      <name>ProjetSI_client</name>
      <url>http://maven.apache.org</url>

      <build>
        <resources>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
            </resource>
            <resource>
                <directory>${project.build.directory}/dist</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <outputDirectory>${project.build.directory}/classes/</outputDirectory>
                </configuration>
            </plugin> 
      </plugins>

      </build>



      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>

    </project>

4.0.0
projet.si
项目
0.0.1-快照
projet.si
项目客户
项目客户
http://maven.apache.org
${basedir}/src/main/webapp
${project.build.directory}/dist
org.apache.maven.plugins
maven资源插件
${project.build.directory}/classes/
UTF-8
模块web pom.xml:

<?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>
    <parent>
        <groupId>projet.si</groupId>
        <artifactId>projetsi</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <groupId>projet.si</groupId>
    <artifactId>ProjetSI_web</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>ProjetSI_web</name>
    <url>http://maven.apache.org</url>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                    <groupId>org.springframework.boot</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>projet.si</groupId>
            <artifactId>ProjetSI_business</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>projet.si</groupId>
            <artifactId>ProjetSI_client</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <configuration>
                            <outputDirectory>${project.build.directory}/dist/</outputDirectory>
                            <includeArtifactIds>ProjetSI_client</includeArtifactIds>
                            <includeGroupIds>projet</includeGroupIds>
                            <includes>**/*</includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

4.0.0
projet.si
项目
0.0.1-快照
projet.si
项目网络
0.0.1-快照
罐子
项目网络
http://maven.apache.org
UTF-8
org.springframework.boot
SpringBootStarterWeb
弹簧启动机tomcat
org.springframework.boot
org.springframework.boot
弹簧启动机tomcat
假如
projet.si
项目业务
0.0.1-快照
projet.si
项目客户
0.0.1-快照
org.springframework.boot
springbootmaven插件
org.apache.maven.plugins
maven依赖插件
${project.build.directory}/dist/
项目客户
projet
**/*
我已搜索stackoverflow,但未找到任何内容:/

如果您需要更多详细信息或代码,请询问我,我会编辑


谢谢

请检查您是否有任何方法附加到您从浏览器点击的url。404-未找到,您尝试访问的资源或url不存在。您应该将控制器的方法映射到“/”或您正在点击的任何url。

什么是“白标错误”?如果你的意思是404,请使用这个术语。我想这是默认的错误404页,来自Spring boot。我已编辑感谢:)对于spring boot starter tomcat依赖项,请删除提供的作用域,然后重试。如果没有提供的作用域,则不会进行任何更改:/