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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • oracle物化视图可以创建索引,oracle 物化视图及创建索引

    oracle物化视图可以创建索引,oracle 物化视图及创建索引物化视图是一种特殊的物理表,“物化”(Materialized)视图是相对普通视图而言的。普通视图是虚拟表,应用的局限性大,任何对视图的查询,Oracle都实际上转换为视图SQL语句的查询。这样对整体查询性能的提高,并没有实质上的好处。1、物化视图的类型:ONDEMAND、ONCOMMIT二者的区别在于刷新方法的不同,ONDEMAND顾名思义,仅在该物化视图“需要”被刷新了,才进行刷新(RE…

    2022年7月22日
    8
  • executorservice 线程池_并发数与线程数

    executorservice 线程池_并发数与线程数keepAliveTime:表示线程没有任务执行时最多保持多久时间会终止。默认情况下,只有当线程池中的线程数大于corePoolSize时,keepAliveTime才会起作用,直到线程池中的线程数不大于corePoolSize,即当线程池中的线程数大于corePoolSize时,如果一个线程空闲的时间达到keepAliveTime,则会终止,直到线程池中的线程数不超过corePoolSize。但…

    2025年10月18日
    2
  • jsp和servlet区别

    jsp和servlet区别基本介绍Servlet:Servlet是一种服务器端的Java应用程序,具有独立于平台和协议的特性,可以生成动态的Web页面。它担当客户请求(Web浏览器或其他HTTP客户程序)与服务器响应(HTTP服务器上的数据库或应用程序)的中间层。Servlet是位于Web服务器内部的服务器端的Java应用程序,与传统的从命令行启动的Java应用程序不同,Servlet由Web服务器进行加载,该…

    2022年6月29日
    21
  • 计算机等级二级java试题(计算机考试选择题知识点)

    第一章数据结构与算法【考点1】算法的基本概念1、算法:是指一组有穷的指令集,是解题方案的准确而完整的描述。算法不等于程序,也不等于计算方法。2、算法的基本特征:1)确定性,算法中每一步骤都必须有明确定义,不允许有多义性;2)有穷性,算法必须能在有限的时间内做完,即能在执行有限个步骤后终止;3)可行性,算法原则上能够精确地执行;4)拥有足够的情报。3、算法的组成…

    2022年4月13日
    51
  • 秒 毫秒 微秒 纳秒 皮秒。。时间单位换算[通俗易懂]

    秒 毫秒 微秒 纳秒 皮秒。。时间单位换算[通俗易懂]1s=1000ms=1000000微秒=1000000000纳秒=1000000000000皮秒=10^15飞秒=10^18啊秒=10^21仄秒=10^24幺秒1s=10^3ms(毫秒)=10^6μs(微秒)=10^9ns(纳秒)=10^12ps(皮秒)=10^15fs(飞秒)=10^18as(阿秒)=10^21zm(仄秒)=10^24ym(幺秒)

    2025年9月17日
    4
  • 7、多协议配置以及dubbo协议详解

    7、多协议配置以及dubbo协议详解提供者指定协议:<dubbo:protocolname=”dubbo”port=”20880″/><dubbo:protocolname=”rmi”port=”1099″/><!–使用dubbo协议暴露服务–><dubbo:serviceinterface=”com.alibaba.hello.api.HelloService”version=”1.0.0″ref=”helloService”protoc

    2022年6月19日
    41

发表回复

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

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