401 Unauthorized in Tomcat

24,188

Solution 1

I discovered today that if you have a syntax error in your tomcat-users.xml file, the Manager app will start up but you won't be able to login. Make sure that all of your XML tags are closed properly and that you don't have any typos.

Solution 2

Have you tried:

<tomcat-users>
<role rolename="admin"/>
<role rolename="standard"/>
<role rolename="manager"/>
<user name="admin" password="" roles="standard,admin,manager" />
</tomcat-users>

manager role is required for Tomcat manager. admin role is required for Tomcat host-manager.

I'm not sure if the "standard" role is necessary but it is in the Tomcat documentation.

http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Configuring%20Manager%20Application%20Access

Solution 3

Make sure you are not typing user and role entries outside comment areas in tomcat-users.xml.

I myself was editing this file with emacs, which was not showing xml comments. I had inserted name, pass, role, everything... as a comment. Minutes had gone away 'til I gedited the file and saw I was putting user data inside a comment.

Check this and save time!

Solution 4

The documentation is here. Have you refreshed (or even restarted) the browser?

You need to find out if the file is in the correct place and being used at all. What happens if you deliberately enter the wrong password? Does it give you a chance to get the password correct? Does it work if you have a non-blank password?

Share:
24,188
Stardust
Author by

Stardust

Updated on January 26, 2020

Comments

  • Stardust
    Stardust over 4 years

    I'm using Tomcat 6.0 as a webserver, and I'm trying to open tomcat manager page, but whenever I enter the username as specified in tomcat-users.xml file, I'm getting an error as:

      **401 Unauthorized**
    

    Here's my tomcat-users.xml file:

    <tomcat-users>
    <role rolename="manager"/>
    <user name="admin" password="" roles="admin,manager" />
      </tomcat-users>
    

    I restart the tomcat, but it has not helped me. Could someone please tell me what's going on wrong?