我正在尝试登录到 Tomcat 服务器,但我无法登录,但我有正确的凭据并且我已经在线尝试了所有解决方案。
这是来自 tomcat-users.xml 文件的有用代码
<tomcat-users>
<role rolename="manager-gui"/>
<user username=“collin” password=“bhbl21” roles="manager-gui"/>
</tomcat-users>
(我没有把它注释掉,我知道这很常见。)
这是我的 server.xml 重要内容:
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
(我知道有些人把 $CATALINA 放在路径名或其他东西的前面。)
我还确保重新启动服务器。所以我觉得它应该可以工作,但它仍然不允许我登录。谁能告诉我我做错了什么?
谢谢!
最佳答案
正如你所说
I cannot login
我假设您在 webapps 中有默认的未修改的管理器应用程序。
我建议尝试删除:
<role rolename="manager-gui"/>
所以你会有这样的东西:
<tomcat-users>
<user username=“collin” password=“bhbl21” roles="manager-gui"/>
</tomcat-users>
也正如 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. It is
strongly recommended that you do NOT use one of the users in the commented out
section below since they are intended for use with the examples web
application.
-->
进一步阅读引用: https://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
关于java - Tomcat 7.0.79 服务器认证问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45528871/