tomcat管理界面登录无法进入

问题:

在打开tomcat界面之后,点击Manger App准备进入管理界面,路径:http://localhost:8080/manager/html。 输入正确的用户名和密码,但是出现401界面。

准备如下
首先在 tomcat /conf/ tomcat-users.xml
中添加了

<role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
<role rolename="manager-status"/>
  <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status"/>

该配置,但是重启tomcat之后,输入正确的用户名和密码, 还是无法进入Manger App ,直接进入401.
这里写图片描述
这里写图片描述

解决办法:

  被该问题困扰了很久,最后还是成功解决了,希望能帮到被次问题困扰的人。

1,重新下载tomcat安装版,我用的是解压版的,然后重新配置就好了。很是无语。

2,重新使用解压版的,将安装版的tomcat-users.xml 覆盖解压版的tomcat-users.xml,然后就好了。

这里写图片描述
完整的配置为:

<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->

  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager-gui"/>
  <user username="tomcat" password="tomcat" roles="tomcat,manager-gui"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>

可以直接复制上面的到 tomcat-users.xml 保存运行就可以了。

原文地址:https://www.cnblogs.com/xuwujing/p/7536701.html