我正在使用tomcat 8.5.13使用redhat在AWS实例上部署我的第一个webapp。 Tomcat已成功安装,因为我可以看到tomcat登录页面。现在问题有2个部分;
当我尝试访问“Manager App”时,它会弹出“需要身份验证”弹出窗口 在提供用户名和密码详细信息之后,甚至反复提它继续 无休止地出现,直到我强行关闭它,然后错误401 出现。
我更新了Tomacat-users.xml,如下所示;
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="******" password="******" roles="manager-gui,manager-
status,manager-script,manager-jmx"/>**
</tomcat-users>
问题的第二部分是如果我删除第一行,即
<tomcat-users>
它接受用户名和密码,并允许我访问'Tomcat Web应用程序管理器页面。但是,尝试打开webapp本身 失败并显示以下错误消息;
HTTP状态404 - 未找到 输入状态报告 消息/DevopsBank-0.0.1-SNAPSHOT/ 说明源服务器未找到目标资源的当前表示,或者不愿意披露目标资源的存在。
你能告诉我出了什么问题。
答案 0 :(得分:0)
tomcat-users.xml需要提到的XML命名空间。确保你将它们安装到位如下:
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
答案 1 :(得分:0)
我认为您正在尝试使用本地tomcat安装。 AWS是云计算PaaS服务。所以他们已经安装了tomcat。尝试按照亚马逊的文档来部署您的应用
Creating and Deploying Java Applications on AWS Elastic Beanstalk
答案 2 :(得分:0)
下面的配置对我来说很好
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="tomcat" password="123" roles="tomcat"/>
<user username="both" password="123" roles="tomcat,role1"/>
<user username="role1" password="123" roles="role1"/>
<user username="souvik" password="xyz123" roles="manager-gui,manager-script,manager-jmx,manager-status" />
</tomcat-users>