无法使用Tomcat Manager部署war文件

时间:2016-02-10 17:08:32

标签: java eclipse apache maven tomcat

我无法使用Tomcat Manager部署war文件 我的\ Tomcat \ conf \ tomcat-users.xml如下所示:

<!--
<role rolename="manager-gui"/>    
<user name="tomcat" password="admin" roles="admin-gui,standard,manager-gui"/>
-->

此外,在localhost-config \ tomcat-users.xml中编辑\ Servers \ Tomcat v7.0服务器

<!--
<role rolename="manager-gui"/>    
<user name="tomcat" password="admin" roles="admin-gui,standard,manager-gui"/>
-->

在启动服务器http://localhost:8080/manager/html并提供适当的凭据

时,仍显示以下错误
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 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.

我还尝试将manager.xml添加到\ Tomcat \ conf但没有任何工作

<Context privileged="true" antiResourceLocking="false"
         docBase="${catalina.home}/webapps/manager">
  <Valve className="org.apache.catalina.valves.RemoteAddrValve"
         allow="127\.0\.0\.1" />
</Context>

注意:我正在重新启动服务器并且http://localhost:8080/无效

2 个答案:

答案 0 :(得分:1)

您需要在tomcat-users.xml中取消注释用户条目。

您需要将用户添加到/tomcat-users.xml,否则您无法通过经理应用部署war文件。

示例:

<user username="craigmcc" password="secret" roles="standard,manager-script" />

更多configuration details are here

答案 1 :(得分:1)

<role><user>标记只是XML注释中的纯文本,由<!---->包围。删除评论的开头和结尾。

<!--    <<< BEGINNING OF COMMENT. Remove this line
<role rolename="manager-gui"/>    
<user name="tomcat" password="admin" roles="admin-gui,standard,manager-gui"/>
-->     <<< END OF COMMENT.       Remove this line