FYI: I encountered the same error 401 (in Tomcat 7), but was based on a completely different problem related to copying and pasting tomcat-users.xml definitions from the Internet. There are two types of double quotes (for example, different Unicode characters) that look almost the same, and so I missed this problem for hours!
One type of double quotation mark (the one that works) is the direct type "(Unicode character U + 0022), the other (which does not work) is the curved or curly or italic or" right "type" (Unicode character U + 201D).
My login worked flawlessly after replacing the wrong double quotes with the correct ones.
The key that made me find this problem was to look at catalina.out, which reports the following error (Note: in my tomcat-users.xml file, I deleted all comments to make sure I was dealing with simple XML- instructions for isolation problem):
SEVERE: Parse Fatal Error at line 4 column 18: Open quote is expected for attribute "{1}" associated with an element type "rolename".
My login worked flawlessly after replacing the wrong quotes.
source share