我创建了一个Web应用程序,当我使用tomcat7作为普通war文件运行时:运行我可以打开我的浏览器并转到localhost:8080并使用完整的应用程序,我现在想让它部署,所以我使用tomcat7:exec-war然后设置pom.xml文件如下:
的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.Dictionary</groupId>
<artifactId>DistributedSystemsProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<verbose>true</verbose>
<source>1.7</source>
<target>1.7</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<goals>
<goal>exec-war-only</goal>
</goals>
<configuration>
<path>/</path>
<contextReloadable>true</contextReloadable>
<enableNaming>false</enableNaming>
<finalName>dictionary-service.jar</finalName>
<charset>utf-8</charset>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
这会在工作区中创建一个JAR文件,但是当我运行它时,我得到以下内容:
Dec 21, 2017 2:02:43 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 21, 2017 2:02:43 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Dec 21, 2017 2:02:43 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
Dec 21, 2017 2:02:43 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
然后,当我去当地主持人8080时,我得到一个页面未找到回复,如果有人可以帮助我这个id非常感谢它,因为我迷失了,无法在网上找到任何东西。