登录Tomcat时出现401未经授权的错误

时间:2020-09-18 11:09:13

标签: tomcat tomcat9

我正尝试登录Windows 10的Tomcat 9.0.38(apache-tomcat-9.0.38.exe)。 我收到错误消息:

401 Unauthorized
You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp

1 个答案:

答案 0 :(得分:0)

我有Windows 10美国/英语版本,但控制台应用程序的代码页为UTF-8: how to set UTF-8 codepage for console applications

C:\Tomcat\conf>chcp
Active code page: 65001

因此,在安装过程中,apache-tomcat-9.0.38.exe根据自己的观点生成了具有正确编码的C:\ Tomcat \ conf \ tomcat-users.xml: encoding in compare

因此将加载编码为'cp65001'的编码为C:\ Tomcat \ conf \ tomcat-users.xml的文件,而不会发出任何警告,但不会启动值。

将tomcat-users.xml的编码更改为utf-8,可以解决用户登录Tomcat的问题。