Brett Brett - 1 year ago 154
Java Question

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):


> dir
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:\Program Files\Java\jdk1.8.0_60

> echo %http_platform_port%

> cat web.config
<?xml version="1.0" encoding="UTF-8"?>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
<httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
arguments=" -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\web-0.0.1-SNAPSHOT.war&quot;">

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download