1
votes

I have written a core java web application using maven-archetype-webapp and trying to deploy the jar file and web.config in a azure windows based webapp but not able to access the url. I only have home page inside my application. and following below steps. I am able to run it in my local system and can see the homepage.

  1. azure-webapp-maven-plugin added in POM and build with mvn azure-webapp:config, then inside configuration tag I added below tag.
<appSettings>
    <property>
        <name>JAVA_OPTS</name>
        <value>-Dserver.port=80</value>
    </property>
</appSettings>
  1. Created a web app in Windowsusing Java 8 and Tomcat 8.5
  2. Deployed jar file and web.config file inside wwwroot directory

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

Folder Structure

enter image description here

Azure directory structure

enter image description here

Local system Output:

enter image description here

1
I am not quite sure what is your problem? - Vova Bilyachat
When I am clicking on the azure web app url I am getting response saying Service unavailable. In my local system I am able to run the application in tomcat and can see the home page. - soumen
Are you using spring? - Vova Bilyachat
No, this is a core java application. - soumen
Found the solution, deployed the war file inside wwwroot -> webapps folder in azure webapp. Before deploying deleted the Root folder inside webapps, after my deployment new root folder was automatically generated, now I can access the url. - soumen

1 Answers

0
votes

Thanks @soumen for the solution.

Deployed the war file inside wwwroot -> webapps folder in azure webapp. Before deploying deleted the Root folder inside webapps, after my deployment new root folder was automatically generated, now I can access the url.

I take it as an answer, hoping to help other members.