We will create Java web app in Azure App Service by using the Azure portal. The Azure portal is a web interface that we can use to manage Azure resources.
We require a Microsoft Azure Subscription.
JAVA application options
There are several ways we can set up Java application in an App Service web app:
1) Use template from the Azure Marketplace
The Azure Marketplace includes templates that automatically create and configure Java web apps with Tomcat or Jetty web containers. Web containers that the templates set up are configurable.
2) Create app and then configure Application settings.
App Service provides several Tomcat and Jetty versions, with default configuration. If the application that we will be hosting will work with one of the built-in versions, this method of setting up web container is the easiest but it lacks configuration capabilities in other methods. For this method, we create app in portal and then go to app’s Application settings blade to choose our version of Java along with desired Java web container. When we use this method the app runs from local hard drive that is used by worker to host app, which does not take disk space away from tenant. When we use this model, we don’t have access to edit files in this part of file system.
3) Create app and then manually copy and edit configuration files
We might want to host custom Java application that does not deploy in any of the web containers provided by App Service.
Create and configure JAVA web app
We will create web app and configure it for Java using Application settings blade of portal.
1) Log in to http://portal.azure.com
2) Click New >> Web + Mobile >> Web App.
3) Enter name for web app in Web app box.
This name must be unique in the azurewebsites.net domain because URL of web app will be .azurewebsites.net. If the name you enter isn’t unique, a red exclamation mark appears in the text box.
4) Select Resource Group or create new one.
5) Select App Service plan/Location or create new one.
6) Click Create.
8) Click Application settings.
9) Choose desired Java version.
10) Choose desired Java minor version. If we select Newest, our app will use newest minor version that is available in App Service for that Java major version.
11) Choose desired Web container. If we select container name that starts with Newest, our app will be kept at the latest version of that web container major version that is available in App Service.
12) Click Save.
Within few moments, our web app will become Java-based and configured to use web container we selected.
15) Click URL to browse to new site.
The web page confirms that we have created Java-based web app.