Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何获得Tomcat';s访问servlet列表的管理员用户和密码_Java_Tomcat_Servlets_Web Applications - Fatal编程技术网

Java 如何获得Tomcat';s访问servlet列表的管理员用户和密码

Java 如何获得Tomcat';s访问servlet列表的管理员用户和密码,java,tomcat,servlets,web-applications,Java,Tomcat,Servlets,Web Applications,当我访问localhost tomcat并单击“ManagerApp”时,我得到的就是这个 403 Access Denied You are not authorized to view this page. 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 s

当我访问localhost tomcat并单击“ManagerApp”时,我得到的就是这个

403 Access Denied
You are not authorized to view this page.

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 appliction'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.

<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>
Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access.

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
The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection:

Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles.
If the text or jmx interfaces are accessed through a browser (e.g. for testing since these interfaces are intended for tools not humans) then the browser must be closed afterwards to terminate the session.
For more information - please see the Manager App HOW-TO.
403访问被拒绝
您无权查看此页面。
如果您已经将Manager应用程序配置为允许访问,并且使用了浏览器后退按钮、已保存的图书标记或类似功能,则可能触发了已为Manager应用程序的HTML界面启用的跨站点请求伪造(CSRF)保护。您需要通过返回到主管理器页面来重置此保护。返回此页面后,您将能够继续正常使用Manager应用程序的HTML界面。如果继续看到此拒绝访问消息,请检查您是否具有访问此应用程序所需的权限。
如果尚未更改任何配置文件,请检查安装中的conf/tomcat-users.xml文件。该文件必须包含允许您使用此webapp的凭据。
例如,要向名为tomcat、密码为s3cret的用户添加manager gui角色,请将以下内容添加到上面列出的配置文件中。
请注意,对于Tomcat7以后的版本,使用manager应用程序所需的角色已从单个manager角色更改为以下四个角色。您需要为希望访问的功能分配所需的角色。
manager gui-允许访问HTML gui和状态页面
管理器脚本-允许访问文本界面和状态页面
manager jmx-允许访问jmx代理和状态页面
管理器状态-仅允许访问状态页面
HTML接口受CSRF保护,但文本和JMX接口不受保护。要维护CSRF保护,请执行以下操作:
具有manager gui角色的用户不应被授予manager脚本或manager jmx角色。
如果通过浏览器访问文本或jmx接口(例如,用于测试,因为这些接口用于工具而非人类),则随后必须关闭浏览器以终止会话。
有关更多信息,请参阅Manager应用程序指南。
那么我如何解决这个问题呢?

添加

<user name="admin" password="admin" roles="admin-gui,manager-gui" />

tomcat目录/conf/tomcat users.xml
标记并重新启动tomcat服务,然后使用此凭据登录到
localhost:8080
IP:8080

您可以从
tomcat users.xml
文件更改用户名和密码

当您访问
localhost:8080
并单击
主机管理器
或其他页面时,它将询问用户名和密码,然后添加上述
凭据

这样就不会出现上述错误

这是您在安装tomcat时必须提供的凭据


仍然有问题请发邮件给我。

添加到
tomcat users.xml
并重新启动tomcat服务并使用此凭据登录。好吧,您刚才粘贴的消息中有很多说明。你试过哪一个了?谢谢,现在可以了,我在角色名之前定义用户名,然后我倒过来把它放在最后,然后它就可以了,对不起,这是个愚蠢的问题,但我坚持了几个月,哈哈,再次谢谢。好的,干杯。。保持微笑……)