After installation, very first thing we tend to check is to access Tomcat Manager. after you try and login into Tomcat Manager, it provides you 401 (Unauthorized) error. To fix, you have got to try to following:
Note: Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the roles required for the functionality you wish to access.
manager-gui: allow access to the HTML GUI and the status pages manager-script: allow access to the text interface and the status pages manager-jmx: allow access to the JMX proxy and the status pages manager-status: allow access to the status pages only
Now, let’s fix Login Issue for Tomcat Manager 7
- Go to Tomcat installation directory and traverse to conf folder
- Add below parameter in server.xml. This must be added under “Engine” context, see below snapshot.
<Realm className="org.apache.catalina.realm.MemoryRealm" />
Role addition in tomcat-users.xml
- Uncomment role section in tomcat-users.xml
- Add role for manager and manager-gui
<role rolename="manager"/> <role rolename="manager-gui"/>
- Add username and assign role as manager & manager-gui
<user username="admin" password="tomcat" roles="manager"/>
Your tomcat-users.xml should look like this:
Restart Tomcat and verify your access. This has helped and I hope you too.