如何在Azure App Service上部署jHipster,我有500个请求超时

问题描述 投票:2回答:1

Microsoft提供的此指南适用于Spring Boot App

https://docs.microsoft.com/en-us/azure/app-service/app-service-deploy-spring-boot-web-app-on-azure

这基本上是:

  1. 创建用于Java的Azure Web应用程序
  2. 指定Java版本
  3. 获取FTP部署凭据
  4. 上传Spring Boot .JAR以及提供的web.config
  5. 通过Azure门户重新启动Web应用程序
  6. 该应用程序工作!

jHipster不是使用.jar而是生成.war文件。由于它基本上是相同的(即它可以用java -jar执行),我希望这些步骤也适用于.war

我上传了:

  1. .war文件
  2. .war.original文件
  3. 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 &quot;%HOME%\site\wwwroot\gmbgenpro-0.0.1-SNAPSHOT.war&quot;">
    </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参数,而且我不知道该怎么做。

azure spring-boot deployment jhipster azure-web-app-service
1个回答
0
投票

要将JHipster项目部署为WAR文件,请确保在启用spring-boot.repackage.skip选项的情况下构建它。这将跳过构建可执行的WAR文件,并简单地将WAR文件打包在$ {finalName} .war下。这样,您可以将应用程序部署到Azure上自动为您配置的Web运行时。

要继续部署,请按照下列步骤操作:

  1. 将以下Maven插件配置添加到pom.xml的main元素: <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>
  2. 使用以下命令构建项目,并相应地调整您的配置文件: ./mvnw clean package -Pdev -Dspring-boot.repackage.skip=true
  3. 部署您的应用程序: ./mvnw azure-webapp:deploy

有关Azure应用服务的Maven插件的最新信息,请查看documentation

© www.soinside.com 2019 - 2024. All rights reserved.