0

I would like to deploy my (Minimal-J) web application to the azure cloud. But it's not a servlet nor a spring-boot application. The application uses an internal web server called 'nanohttpd' and is started with a main method.

Can I deploy this without 'springify' the application to the azure cloud?

Bruno Eberhard
  • 1,624
  • 16
  • 22

1 Answers1

0

It sounds like your Java Web Application embedded a special web server nanohttpd to handle HTTP requests, but not like servlets serve in Java Web Container. So I think you can package it as a Runnable Jar file to start with a main method via command java -jar <your jar file name>.jar. If yes, you can create a Azure WebApp and follow my answers for these similar SO threads below to configure the web.config file of your web app to start a runnable jar file.

  1. Deploying Springboot to Azure App Service
  2. Run jar as a webapp on Azure
  3. Azure uploaded jar but doesn't run it (Spring boot)

Here is a sample configuration.

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

Per my experience, it's a simple and light solution for your current scenario.

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