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.
- Deploying Springboot to Azure App Service
- Run jar as a webapp on Azure
- 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 "%HOME%\site\wwwroot\<your runnable jar file name>.jar"">
</httpPlatform>
</system.webServer>
</configuration>
Per my experience, it's a simple and light solution for your current scenario.