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.x开发者_如何学Cml 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?
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.
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
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?
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!
精彩评论