Microsoft提供的此指南适用于Spring Boot App
https://docs.microsoft.com/en-us/azure/app-service/app-service-deploy-spring-boot-web-app-on-azure
这基本上是:
jHipster不是使用.jar
而是生成.war
文件。由于它基本上是相同的(即它可以用java -jar
执行),我希望这些步骤也适用于.war
。
我上传了:
.war
文件.war.original
文件web.config
这是前面提到的web.config
。请注意我已将-jar重命名为-war
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -war "%HOME%\site\wwwroot\gmbgenpro-0.0.1-SNAPSHOT.war"">
</httpPlatform>
</system.webServer>
</configuration>
该应用程序加载太长时间,我得到了500 request timed out.
编辑:我已经在web.config中启用了stdout
,我从日志文件中获得了以下内容:
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Unrecognized option: -war
所以我似乎无法使用-war参数,而且我不知道该怎么做。
要将JHipster项目部署为WAR文件,请确保在启用spring-boot.repackage.skip
选项的情况下构建它。这将跳过构建可执行的WAR文件,并简单地将WAR文件打包在$ {finalName} .war下。这样,您可以将应用程序部署到Azure上自动为您配置的Web运行时。
要继续部署,请按照下列步骤操作:
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<!-- check Maven Central for the latest version -->
<version>1.3.0</version>
<configuration>
<resourceGroup>your-resource-group</resourceGroup>
<appName>your-app-name</appName>
<linuxRuntime>tomcat 9.0-jre8</linuxRuntime>-->
</configuration>
</plugin>
./mvnw clean package -Pdev -Dspring-boot.repackage.skip=true
./mvnw azure-webapp:deploy
有关Azure应用服务的Maven插件的最新信息,请查看documentation。