简体   繁体   English

Azure已上传jar,但未运行它(春季启动)

[英]Azure uploaded jar but doesn't run it (Spring boot)

I've got myself an Azure Web App Service and a SQL database to go with it. 我已经拥有一个Azure Web App Service和一个SQL数据库。 I'm using Azures Intellij plugin to "Run On Web App". 我正在使用Azures Intellij插件来“在Web App上运行”。 Issue is, it doesn't run anything, however it does put the jar in the folder: 问题是,它什么也没运行,但是确实将罐子放在文件夹中:

Connecting to FTP server...
Uploading artifact to: /site/wwwroot/ROOT.jar ...
Uploading successfully...
Start Web App...
Logging out of FTP server...
Deploy successfully!

I then, using console try to run the ROOT.jar by using java -jar ROOT.jar , but I get the error message 我然后使用控制台尝试运行ROOT.jar通过使用java -jar ROOT.jar ,但我得到的错误信息

Java is not recognised as an internal command or external command Java不被识别为内部命令或外部命令

In the webapp application settings I have Java Version: Java 8 So I'd assume it'd give me the ability to run java, but this has just made me question the way I'm doing it. 在webapp应用程序设置中,我具有Java Version: Java 8因此,我认为它可以让我运行Java,但这只是让我怀疑我的操作方式。 Am I deploying the app wrong? 我部署应用程序是否错误?

It sounds like your SpringBoot project lacked a web.config file which will be deployed at the path wwwroot for helping to handle your ROOT.jar . 听起来您的SpringBoot项目缺少web.config文件,该文件将部署在路径wwwroot以帮助您处理ROOT.jar

Here is a sample web.config file for SpringBoot runnable jar. 这是SpringBoot可运行jar的示例web.config文件。

<?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\ROOT.jar&quot;">
    </httpPlatform>
  </system.webServer>
</configuration>

As above, it comes from my answer of a similar SO thread Deploying Springboot to Azure App Service which you can refer to. 如上所述,它来自于我类似的将Springboot部署到Azure App Service的 SO线程的答案,您可以参考。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM