java - 无法登录 Tomcat 管理器

标签 java tomcat

我的 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"/>
-->

我什至没有看到以管理员身份运行以在括号中打开。我该怎么办?

最佳答案

您需要取消注释 userrole所述 xml 中的条目以启用登录用户。

这个条目应该让你去 - <role rolename="manager"/> <user username="admin" password="admin" roles="manager"/>

我认为这不言而喻,您需要拥有 write Tomcat 的特权主目录。

附言不要忘记重启服务器

关于java - 无法登录 Tomcat 管理器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36643960/

相关文章:

tomcat - tomcat 的 java.naming.provider.url 是什么

tomcat - 如何在tomcat服务器上运行servlet

java - 为什么我无法从浏览器中看到我的 js 文件 - tomcat 7

JAVA 8没有jrunscript,只有jjs

Java - 使用 HttpURLConnection 发出 POST 请求并将图像发送到服务器

java - Java中执行/usr/bin/env bash -c "command"

php - 用于部署的语言/堆栈

java - 修改 JSF 代码时 session 如何保持打开状态?

java - 为什么带有换行符的字符串与Java中的正则表达式不匹配?

java - 输入元素的 onclick 内的 document.getelementbyid