Tomcat的Manager显示403 Access Denied

Tomcat的Manager显示403 Access Denied

大家好,又见面了,我是全栈君。

管理tomcat的时候遇到了以下问题:

  1.刚开始需要用户名密码,不知道用户名和密码是什么,但是输入什么都不正确。

  解决办法:

  自己在tomcat-users.xml中按格式添加用户 conf文件夹里面

  默认是注释掉了的,这主要是考虑到服务器的安全,如果是本地测试,去掉以下这段注释,然后重启动服务器,再输入

   <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″/>

  用户和密码都一目了然了。

2.进入manager界面之后,显示的是403 Access Denied。

  解决办法:

  在conf/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.

  也就是说,为了考虑安全,tomcat默认还是没有manager-gui的管理权限的,如果想要使用manager

  的话,需要自行加入管理权限(角色)。

  需要加一个这样的权限(角色)

  <role rolename=”manager-gui”/>

  然后再加到需要的用户名中去

  <user username=”tomcat” password=”tomcat” roles=”tomcat,manager-gui”/>

  这样OK了。

<?xml version='1.0' encoding='utf-8'?>
<!--
  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
  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"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
    <role rolename="manager-gui"/>
    <role rolename="admin-gui"/>
    <user username="ming" password="064417" roles="manager-gui,admin-gui"/>

</tomcat-users>

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/108470.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • ACdream 1099 瑶瑶的第K大

    ACdream 1099 瑶瑶的第K大

    2021年12月2日
    40
  • 小程序:matlab解微分方程「建议收藏」

    functionf=ball_trajectory(t,y);g=9.81;pi=3.14159265;air_density=1.20;M=57.5*0.001;D=64.0*0.001;R=D*0.5;A=pi*R*R;Cd=0.507;ratio_Cl_to_S=0.5

    2022年4月16日
    39
  • t检验和u检验_均匀性检验界值表

    t检验和u检验_均匀性检验界值表常用显著性检验适用于计量资料、正态分布、方差具有齐性的两组间小样本比较。包括配对资料间、样本与均数间、两样本均数间比较三种,三者的计算公式不能混淆。应用条件与t检验大致相同,但t′检验用于两组间方差不齐时,t′检验的计算公式实际上是方差不齐时t检验的校正公式。应用条件与t检验基本一致,只是当大样本时用U检验,而小样本时则用t检验,t检验可以代替U检验。用于正态分布、方差齐性的多组间计量比较。常见的…

    2025年6月12日
    0
  • 驾校学员管理系统_驾校管理系统

    驾校学员管理系统_驾校管理系统mysql-uroot-p-u表示选择登陆的用户名,-p表示登陆的用户密码,上面命令输入之后会提示输入密码,此时输入密码就可以登录到mysql创建数据库:createdatabasedrivingschool;选择数据库:usedrivingschool;转载于:https://www.cnblogs.com/zgytbn/p/8296799.html…

    2022年9月20日
    0
  • qt运行cmd命令_cmd ping大包命令

    qt运行cmd命令_cmd ping大包命令0-问题描述在实现QT调用外部程序cmd.exe的时候传回来的参数需要显示在textbrowser控件上,但是一直等待数据全部接受完毕会才显示,会导致页面卡死的假象,所以下面利用append()进行每次都更新,可以很好的解决这个问题。1-解决方案//mainwindow.cpp文件,主界面实现#include”mainwindow.h”#include”ui_mainwindow.h…

    2022年9月15日
    0
  • MATLAB GUI显示图片的方法

    MATLAB GUI显示图片的方法前言  在MATLAB的命令行中显示图片或者数据,十分简单,仅通过imshow,plot或者imagesc等函数即可。  而在MATLABGUI中显示图片,通常需要借助Axes控件来实现。相比而言,多一些操作。在GUI中显示图片  创建一个空白的界面  在GUIDE中,添加一个按钮,然后再添加一个Axes控件,适当调整两者比例。然后在Button的回调函数中添加如下代码%…

    2022年6月11日
    275

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号