启动Tomcat 7.0.53时报错 401 Unauthorized

错误信息部分如下:401 Unauthorized

 

You are not authorized to view this page. If you have not changed any configuration files,
please examine the file conf/tomcat-users.xml in your installation.
That file will contain the credentials to let you use this webapp.  
  
You will need to add manager role to the config file listed above. For example:  
  
<role rolename="manager"/>  
<user username="tomcat" password="s3cret" roles="manager-gui"/>  
  
For more information - please see the Manager App HOW-TO.

这个问题是有访问权限造成的,所使用的用户不具有相关权限,解决方法如下:找到 Tomcat 文件下找到 conf 文件

 

 在tomcat-users.xml 中:

 

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="manager"/>
  <user username="admin" password="admin" roles="manager-gui"/>
</tomcat-users>

注意:我的 Tomcat 是 7.0 版本,roles="manager-gui";Tomcat版本不同,也可能存在 roles="manager",具体视情况而定。

 

大笑我的问题只改动tomcat-users.xml即解决。


------------------------------------------------------------------------------------------------------------------------------------------------------------------------

在查找前辈方法时,有将 conf文件下 context.xml 进行了改动的,代码如下:

 

<Context>
    <WatchedResource>WEB-INF/web.xml</WatchedResource>   
    <Manager pathname="/manager" debug="0"  privileged="true" docBase="/home/oracle/tomcat/apache-tomcat-6.0.18/webapps/manager" />   
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> 

</Context>

如果只改动tomcat-users.xml不能解决问题,可尝试同时修改context.xml (ps: 我尝试了一下同时改,没有解决问题... 闭嘴)。

 

 

不对之处欢迎大家指正!谢谢!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值