0

I've got myself an Azure Web App Service and a SQL database to go with it. I'm using Azures Intellij plugin to "Run On 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

Java is not recognised as an internal command or external command

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. Am I deploying the app wrong?

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
user3667111
  • 611
  • 6
  • 21
  • You should share what platform you are on. And then fix your command line so the appropriate `java` executable is on your PATH or %path% (or you use the absolute path to the executable). This really has nothing to do with Azure or Spring. The command line is telling you it can't find an executable called "java". –  Dec 11 '18 at 21:20
  • Yeah I know the error message has nothing to do with spring or azure, but I mean the fact that this is how it's deploying could possibly indicate that I'm deploying it wrong? As in, shouldn't it run out of the box without me having to run the jar @jdb – user3667111 Dec 11 '18 at 21:23
  • plus I'm unsure how to set the path through commandline @jdv – user3667111 Dec 11 '18 at 21:37
  • I guess I don't understand what you are doing. If you are using an Intellij plugin, stay in the UI and use the plugin gestures the plugin gives you. Even opening up a shell in the IDE won't necessarily have any Java since Intellij bundles its own Java runtime for running Java based gestures. e.g.: https://azure.microsoft.com/en-us/blog/intellij-deploy-java-web-apps-to-azure/ –  Dec 11 '18 at 21:43
  • I'm pretty sure you need to deploy as a WAR, even if it's Spring Boot to get this to work as an Azure Web App. – Alexis Murray Dec 12 '18 at 02:27
  • Did you mean you run the jar in the Kudu cmd, if yes,you could not run jar there.And what did you mean "it doesn't run anything", did it show nothing when you went to browse the web? – George Chen Dec 12 '18 at 02:31

1 Answers1

1

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.

Here is a sample web.config file for SpringBoot runnable 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\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.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43