在我的项目中,我成功地将jersey api部署到了Azure上,并将ROOT.war文件放入/ wwwroot / webapps中,并且tomcat成功地提取了该文件,并且该目录中显示了所有项目内容。但是应用程序总是返回404,我不知道为什么。 这是我的pom.xml文件:
<groupId>patientinformationdisplayer</groupId>
<artifactId>pom</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>2.28</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.5.3</version>
<configuration>
<!-- App information -->
<resourceGroup>team19backend</resourceGroup>
<appName>team19backend</appName>
<region>UK south</region>
<!-- Java Runtime Stack for App on Linux-->
<linuxRuntime>tomcat 8.5-jre8</linuxRuntime>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>HoloBackend.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
我不知道部署过程如何,这花了我整整一天的时间。请帮助我解决此问题,非常感谢您。
答案 0 :(得分:0)
如果将应用程序部署到本地Tomcat,可以使用根URL访问该站点吗? 推荐的方法来删除现成的ROOT /目录。请仔细检查您是否已完成。
您可能还想参考http://tomcat.apache.org/tomcat-7.0-doc/config/context.html,其中指出:
此Web应用程序的上下文路径,该路径与每个请求URI的开头匹配,以选择适当的Web应用程序进行处理。特定主机内的所有上下文路径必须唯一。如果指定空字符串(“”)的上下文路径,则将为此主机定义默认的Web应用程序,它将处理所有未分配给其他上下文的请求。 仅当在server.xml中静态定义上下文时,才必须使用此属性。在所有其他情况下,将从用于.xml上下文文件或docBase的文件名中推断出路径。
即使在server.xml中静态定义上下文时,也不得设置此属性,除非docBase不在主机的appBase下,或者deployOnStartup和autoDeploy均为false。如果不遵循此规则,则可能会导致双重部署。
此链接(http://stackoverflow.com/questions/16160565/configure-the-path-localhost-of-the-war-application-to-be-the-root-java-ee)可能会为您提供帮助。
希望有帮助。