tomcat的管理(manager)报错403

管理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://www.cnblogs.com/fengzhongzhuzu/p/9194916.html

时间: 2024-11-05 11:48:30

tomcat的管理(manager)报错403的相关文章

windows平台在tomcat中启动cas报错解决

windows平台在tomcat中启动cas报错: Caused by: java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no jansi in java.library.path, 系统找不到指定的路径.] 解决办法:将jansi.dll文件放到C:\Windows\System32目录下即可. 注意:jansi.dll文件在使用gradle编译打包cas时会下载到C:\Users\${用户名}\.gradle

利用Tomcat部署Web项目报错

1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help | start | stop } 八月 18, 2014 7:35:40 下午 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.24 u

HTML-页面图片加载报错403,但可以单独打开图片的问题解决

场景:遇到站点引用远程图片固定链接时(多为第三方链接),图片会发生在页面无法显示,报错403,但是单独打开该远程链接,又可以打开: 解决方法: 1.数据库中全局下载该字段链接,将图片存到制定文件夹,在系统内调用 2.检查页面head中的是否有此句“<meta name="referrer" content="no-referrer" />”,无则添加 相关资料参见: html访问图片资源403问题(http referrer) 原文地址:https://

linux:记录一次 处理tomcat启动卡死无报错现象的曲折过程

一.环境 系统:CentOS 5.5 tomcat 6.0 jdk1.6 二.问题现象     我们公司近期请人做的某个项目的一期要完成了,因对方负责java开发的工程师都不懂linux,而且也没有专职的linux工程师,最后的最后就是只能我来部署了,刚开始也没觉得会有多麻烦,按以往的套路来就好了嘛,好吧,先把项目在我本地环境(windows)跑一下,然而...... ........(省略因开发环境不一样造成的揪心过程,还有对方代码的各种坑,然而我还拿不到源文件..) 一翻折腾,终于在本地运行

tomcat中安装JDK报错详细解决过程

在安装tomcat时解压安装JDK时出现如下报错:[[email protected] src]# wget 'http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-i586.tar.gz'--2016-01-18 04:21:56--  http://download.oracle.com/otn-pub/java/jdk/8u65-b17/jdk-8u65-linux-i586.tar.gz正在解析主机 dow

jenkins-系统管理-节点管理进去报错

jenkins本来好好的.正常使用一段时间了:随着业务量增加.一台服务器扛不住了. 于是思考搭建集群. 进入节点管理:点击"新建节点":突然报了个错: 图是随便拉的(因某些不可描述原因)....:不过报错大致是这个样子(报错日志片段): servletException:org.apache.commons.jelly.JellyTagException:jar:file...... hudson.moel.Node.getNodeProperty(Ljava/lang/Class;)

Nginx报错403 forbidden (13: Permission denied)的解决办法

由于开发需要,在本地环境中配置了LNMP环境,使用的是Centos 6.5 的yum安装,安装一切正常,但是由于默认网站文件夹比较奇葩,于是把网站文件用mv命令移动到了新的目录,并相应修改了配置文件,并重启Nginx. 那么好,问题来了!本以为重启就OK了.居然报个“403 is forbidden“的错误..查看/var/log/nginx/error.log日志显示:xxx 403 forbidden (13: Permission denied)错误.我勒个去~ 引起nginx 403 f

ECShop添加新模块,管理权限报错

提示报错信息: Warning: join(): Invalid arguments passed in D:\phpStudy\WWW\TimmyMall\admin\privilege.php on line 607 Warning: Invalid argument supplied for foreach() in D:\phpStudy\WWW\TimmyMall\admin\privilege.php on line 609 解决方法: 权限数据库,新加模块的parent_id找不到

tomcat关闭时Log4j2报错 Log4j Log4j2-TF-4-Scheduled-1 memory leak

出错信息: 23-Sep-2017 17:43:18.964 警告 [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [license] appears to have started a thread named [Log4j2-TF-4-Scheduled-1] but has failed to stop it. This is very li

Linux RabbitMQ导入管理界面报错

执行rabbitmq-plugins enable rabbitmq_management报错如下Plugin configuration unchanged.Applying plugin configuration to [email protected] failed.Could not contact node [email protected] Changes will take effect at broker restart.Options: --online - fail if