【问题标题】:Can I deploy an executable JAR file to Azure PaaS?是否可以将可执行 JAR 文件部署到 Azure PaaS?
【发布时间】:2023-03-27 07:34:01
【问题描述】:

我正在使用适用于 Eclipse 的 Windows Azure 插件,并且我正在尝试将我的 Java(实际上是 Scala)应用程序部署到 Windows Azure。

据我了解,为了将其部署到 Azure PaaS 服务,我必须将其包装在 WAR 文件中,并将其与 JDK 和我选择的应用程序服务器(Tomcat、Jetty 等)一起部署。 Eclipse 的插件将它们全部打包到一个 Windows Azure 包中,然后进行部署。

我的问题是:

如何将不需要 Web 界面的 Java 应用程序部署到 Azure,因此我将其打包为 JAR 而不是 WAR? Azure Java 应用程序是否必须打包在 WAR 中?

使用 Eclipse 插件,它确实让我可以选择要部署的 JAR 文件,但我没有设法让它工作。有人经历过吗?

谢谢,

【问题讨论】:

  • 你最后解决了这个问题吗?

标签: java azure eclipse-plugin executable-jar azure-worker-roles


【解决方案1】:

我不知道在您编写原始问题时这些特定页面是否存在,但 Azure 有用于上传和配置 Java 应用程序的说明页面。

我无法向您提供具体说明,因为首次部署 jar 时有太多不同的选项和配置设置。

一旦部署完毕,还有一组 Azure 期望的配置/属性。

以下是有关部署选项的说明性文章: Deploy your app to Azure App Service

以下是用于部署 WAR 或 JAR 的 Java/JVM 特定配置设置的说明性文章: Upload custom Java web app to Azure

具体看一下 springboot 部分,它有一个 as example 展示了如何运行可执行 jar:

    <?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% -jar &quot;%HOME%\site\wwwroot\my-web-project.jar&quot;">
    </httpPlatform>
  </system.webServer>
</configuration>

最后,这是另一篇关于在 Azure 中创建 Java/JVM 应用的指导性文章: Create a Java web app in Azure App Service

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-02
    • 1970-01-01
    • 2019-12-03
    • 2019-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多