2012-12-29 57 views
1

我已经下载了tomcat7 ZIP文件。解压文件夹后,我去Tomcat7.0/conf目录/目录,并编辑的tomcat-users.xml中到:401登录时管理我的应用程序时未经授权

<tomcat-users> 
    <role rolename="tomcat"/> 
    <role rolename="role1"/> 
    <role rolename="manager"/> 
    <user username="tomcat" password="tomcat" roles="tomcat"/> 
    <user username="both" password="tomcat" roles="tomcat,role1"/> 
    <user username="role1" password="tomcat" roles="role1"/> 

    <user username="admin" password="admin" roles="manager,tomcat,role1"/> 

</tomcat-users> 

于是,我开始了我的tomcat,tomcat的网页上,我点击“Manager App”按钮,弹出一个登录对话框。我输入用户名“admin”和密码“admin”,但我得到了401未经授权的错误。为什么?我的tomcat-users.xml配置有什么问题?

回答

0

你应该给角色名经理桂...它会给权限访问管理应用页面...

0

如果使用Eclipse WTP到管理Tomcat,要小心,因为Eclipse实际上在Workspace的Server项目中复制了配置文件。

1

http://localhost:8080/manager/html

<role rolename="manager-gui"/> 
<user username="tomcat" password="s3cret" roles="manager-gui"/> 

注意引用是为Tomcat 6.0.30开始,使用 管理器应用程序所需的角色,从以下四个角色单一的管理者角色的 改变。

manager-gui - allows access to the HTML GUI and the status pages 
manager-script - allows access to the text interface and the status pages 
manager-jmx - allows access to the JMX proxy and the status pages 
manager-status - allows access to the status pages only 
0

这是因为从Tomcat 7.0起,您需要添加以下四个角色到你的tomcat-users.xml中

注意:我使用的是Tomcat 8.5.9

\ conf \ tomcat-users.xml

<role rolename="admin-gui"/> 
    <role rolename="manager-gui"/> 
    <role rolename="manager-script"/> 
    <role rolename="manager-jmx"/> 
    <role rolename="manager-status"/> 
    <user roles="admin-gui,manager-gui,manager-script,manager-jmx,manager-status" username="tomcat" password="******"/> 
相关问题