I have a web app I want to deploy on Azure. I followed the recommended instructions and deployed my app, and according to the Azure portal, everything is working just fine. However, when I visit the base URL my app should reside in, I see a page that says the following:
This Java based web application has been successfully created
There's nothing here yet, but Microsoft Azure makes it simple to
publish content with GIT and FTP
Also when I visit any one of the endpoints (in this case, the /live endpoint) my app should have, I always see a page with the following message:
HTTP ERROR 404
Problem accessing /live. Reason:
Not Found
Powered by Jetty:// 9.3.13.v20161014
When I look at the directories on the machine, everything seems to be in place. All my files are inside wwwroot. However, there's another directory named webapp under wwwroot and inside it is another directory named ROOT with two files: index.jsp and background.png. index.jsp is the page that shows the aforementioned "There's nothing here yet" message.
I'm using Bitbucket as my source control provider and I use jetty to run my web app. I'm also using javalite as the library to manage my server and different endpoints.
解决方案
You'll need to put your stuff under wwwroot/webapps/ROOT/, or package as ROOT.war and drop that under wwwroot/webapps - it will get picked up and extracted automagically:
wwwroot
└── webapps
└── ROOT
├── about.jsp
├── Content
│ ├── favicon.ico
│ └── Site.css
├── Images
│ ├── banner_coffee.png
├── index.jsp
├── META-INF
│ ├── context.xml
│ └── MANIFEST.MF
├── orderconfirmation.jsp
├── placeorder.jsp
├── Scripts
│ ├── jquery-1.7.1.min.js
└── WEB-INF
├── classes
├── lib
├── log4j.properties
└── web.xml
The main thing in the repo is a webapps folder with ROOT.war. The Tomcat/Jetty server in App Service will look inside this folder for web apps to host.
ROOT.war represents the default web app (at the site root). Any WAR file that's otherwise named represents a web app accessbile at ~/.
Clearing things up
If your application sits in wwwroot/webapps/CoffeeShop/, then you'll access it at http://{site}.azurewebsites.net/CoffeeShop/.
If your application sits in wwwroot/webapps/ROOT/, then you'll access it at http://{site}.azurewebsites.net/.