我的 tomcat 管理器没有任何凭据。一切都有评论。当我运行 http://localhost:8080/manager/html ,它要求输入用户名和密码。当我尝试在没有它们的情况下登录时,它仍然不起作用。我也无法编辑文件以取消注释。
这是 tomcat-users.xml
<?xml version='1.0' encoding='cp1252'?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tomcat-users>
<!--
NOTE: By default, no user is included in the "manager-gui" role required
t o 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"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
-->
我什至没有看到以管理员身份运行以在括号中打开。我该怎么办?
最佳答案
您需要取消注释 user
和 role
所述 xml 中的条目以启用登录用户。
这个条目应该让你去 -
<role rolename="manager"/>
<user username="admin" password="admin" roles="manager"/>
我认为这不言而喻,您需要拥有 write
Tomcat
的特权主目录。
附言不要忘记重启服务器
关于java - 无法登录 Tomcat 管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36643960/