Accessing the Tomcat manager console on Azure Java webapp
If we want to manage different applications deployed on Tomcat server, we will require to setup the access to Tomcat admin console. This can be done if you are using the Marketplace Tomcat server or if you are uploading your custom version of Tomcat server. To check how can you use Marketplace tomcat and custom Tomcat version follow the links -
https://azure.microsoft.com/en-us/marketplace/partners/microsoft/apachetomcat7/ https://azure.microsoft.com/en-us/documentation/articles/web-sites-java-custom-upload/#application-configuration-examples
To setup the Tomcat admin or manager console on Azure Java webapp, follow these settings -
1. Open the Kudu console using the "scm" text azure the webapp name. For eg https://<my web app name>.scm.azurewebsites.net.
2. Using the Debug Console -> CMD prompt, browse to the Tomcat's conf folder. Generally, it will be like D:\home\site\wwwroot\bin\apache-tomcat-7.0.52\conf.
3. Open the tomcat-users.xml file using the Pencil sign underlined in the figure.
4. Edit the tomcat-users.xml file to setup the role for manager and add user for it.
5. So, now you can access the manager-gui using the username/password as tomcat/tomcat.
6. Browse to the manager guid by adding "/manager" to your website URL. For eg https://<my web app name>.azurewebsites.net/manager
7. It will prompt you for username and password. Just enter tomcat for both, you should see the admin screen like below -
So, using this manager console, you can start/stop/deploy/undeploy applications. Basically, you can get complete control of the application that you have deployed.
If you are deploying a huge war file using this method, you may get following exception -
The server encountered an internal error () that prevented it from fulfilling this request.
Exception java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$SizeLimitExceededException
To resolve this, please modify the web.xml under the manager application "manager/WEB-INF/web.xml" to increase the max file size
<multipart-config>
<!– 50MB max –>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
Comments
- Anonymous
March 09, 2016
Hi,I logged into the Kudo SCM of my WebApp but could not locate the folderD:\home\site\wwwroot\bin\apache-tomcat-7.0.52\Under site\wwwroot .... was the 'webapps' folder, bit no 'bin' folder. The webapps folder, were the different WAR (and expanded WAR) folders.There was also a site\App_Data\jobs folder.but I could locate the apache folder under D:\Program Files (x86)\apache-tomcat-7.0.62\conf, but could not edit the server.xml in that folder.It had the 'pencil' symbol, but when saving got a error: Access denied.Any tips?thanksJeevan- Anonymous
March 11, 2016
Hi Jeevan,Thanks for your question.Actually, you cannot use Tomcat manager when you are using the default tomcat deployed on Azure. The configurations that I mentioned are for Tomcat from Gallery/Marketplace or custom Tomcat. The D:\Program Files (x86) is a restricted folder so you wont have write permissions in this folder. Hope that helps!
- Anonymous
- Anonymous
January 10, 2017
The comment has been removed