我遇到了一个问题,无法弄清楚是什么问题。
我使用Spring Boot有一个多模块Maven项目。项目的布局
我正在使用STS,一切都很好。如果我运行该应用程序,它将运行服务器,并且我在Localhost中有索引:8080。
但是,我想从中生成一个罐子。因此,我正在使用 mvn Clean install 。它在/目标中生成一个罐子。罐子中的布局很好,带有来源和客户端的来源。然后,我正在用 java -jar myjar.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
这是我的网络和客户端模块的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>
模块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>
我已经在stackoverflow上搜索了:/
如果您需要更多详细信息或代码,请问我我会编辑。
谢谢!
请检查您是否在URL上附加了任何方法,您的浏览器正在击中。404-找不到,您要访问的资源或URL不存在。您应该有一种映射到"/"的控制器的方法或您要击中的任何URL。