Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Deploy Spring Boot Application to Azure

I cannot get my Spring Boot site to respond on an Azure Web Instance. I've followed the Java app instructions and the upload instructions. It appears that the IIS server is receiving the request, but the servlet in the war is not responding. According to the documentation, there are a couple of gotchas. In particular, the web.config should be deployed to wwwroot and specify the java path as well as the forwarding port. I believe I've covered these bases -- my web.config is pasted below.

I did try deploying a tomcat server from the marketplace, and that worked fine. When I substitute my war file and web.config, the spring boot app does not work.

One interesting piece of information is that the HTTP_PLATFORM_PORT environment variable does not appear to be defined.

App Settings:

app settings

Azure Console Info (Env variables and Web.config):

D:\home\site\wwwroot

> dir
D:\home\site\wwwroot
Volume in drive D is Windows
 Volume Serial Number is 789E-197B

 Directory of D:\home\site\wwwroot

03/01/2016  02:14 AM    <DIR>          .
03/01/2016  02:14 AM    <DIR>          ..
02/29/2016  08:15 PM    <DIR>          bin
03/01/2016  01:49 AM         8,771,899 web-0.0.1-SNAPSHOT.war
03/01/2016  02:10 AM               496 web.config
03/01/2016  02:08 AM               496 web.custom.config
03/01/2016  01:54 AM             4,868 web.tomcat.config
03/01/2016  02:14 AM    <DIR>          webapps



> echo %java_home%
D:\home\site\wwwroot
D:\Program Files\Java\jdk1.8.0_60


> echo %http_platform_port%
D:\home\site\wwwroot
%http_platform_port%


> cat web.config
D:\home\site\wwwroot
<?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\web-0.0.1-SNAPSHOT.war&quot;">
    </httpPlatform>
  </system.webServer>
</configuration>
like image 439
Brett Avatar asked Mar 01 '16 02:03

Brett


1 Answers

Shouldn't that be an executable JAR instead of a WAR? You can run a Spring Boot JAR with just JDK 8 installed, but you need a Java EE app server to deploy a WAR to.

I don't know what the web.config file is; I use Cloud Foundry. All I need is a JAR, a .yml file for configuration, and a JDK. The Spring Boot JAR should have the entire application and its dependencies inside. I use Maven to create the fat JAR.

like image 161
duffymo Avatar answered Sep 30 '22 03:09

duffymo