首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >tomcat部署war包不成功解决方法

tomcat部署war包不成功解决方法

作者头像
全栈程序员站长
发布2022-09-02 10:36:27
发布2022-09-02 10:36:27
1.2K0
举报

大家好,又见面了,我是你们的朋友全栈君。

今天尝试在阿里云服务器中的tomcat部署项目

点击manager App 时页面显示这样,根据上图提示可知原因是cont/tomcat-users.xml 未配置用户名和密码, 所以需要将下面这段配置用户名和密码的代码添加到tomcat-users.xml中

代码语言:javascript
复制
<role rolename="manager-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>

保存后重启tomcat,再点击manage app 后提示输入 账号:tomcat 密码:tomcat 即可打开网址

若出现了403问题,则是因为访问受限了

代码语言:javascript
复制
403 Access Denied
 
You are not authorized to view this page.
 
By default the Manager is only accessible from a browser running on the same machine as Tomcat. If you wish to modify this restriction, you'll need to edit the Manager's context.xml file.
 
If you have already configured the Manager application to allow access and you have used your browsers back button, used a saved book-mark or similar then you may have triggered the cross-site request forgery (CSRF) protection that has been enabled for the HTML interface of the Manager application. You will need to reset this protection by returning to the main Manager page. Once you return to this page, you will be able to continue using the Manager application's HTML interface normally. If you continue to see this access denied message, check that you have the necessary permissions to access this application.
 
If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.
 
For example, to add the manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above

这时候需要修改 /webapps/manager/META_INF/context.xml文件,将文件中对访问的来源受限设置注释:

代码语言:javascript
复制
<Context antiResourceLocking="false" privileged="true" >
  <!--注释这里,去除对访问权限的设置
    <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
         -->
</Context>

修改后再重新点击Manage App 即可打开管理界面

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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年5月3,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档