当Tomcat通过IntelliJ Idea Ultimate 12运行时,我无法访问Tomcat 7管理器 [英] I can't access Tomcat 7 manager when Tomcat is running through IntelliJ Idea Ultimate 12

查看:248
本文介绍了当Tomcat通过IntelliJ Idea Ultimate 12运行时,我无法访问Tomcat 7管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用

http://localhost:8080/manager

但输入密码后我总是被拒绝进入。
我收到以下消息:

but I am always denied the entrance after I enter the password. I get the following message :


403拒绝访问

403 Access Denied

您无权查看此页面。

如果您已将Manager应用程序配置为允许访问
而您已使用浏览器返回按钮,则使用保存的书签或
类似于您可能已触发已为
Manager应用程序的HTML界面启用的跨站点请求伪造
(CSRF)保护。您需要通过
重置此保护,返回主Manager页面。返回此页面后,
将能够继续正常使用Manager应用程序的HTML界面
。如果您继续看到此拒绝访问消息,请检查
您是否具有访问此应用程序所需的权限。

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.

如果您尚未更改任何配置文件,请检查安装中的
文件conf / tomcat-users.xml。该文件必须
包含允许您使用此Web应用程序的凭据。

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.

例如,使用$将manager-gui角色添加到名为tomcat的用户b $ b密码s3cret,将以下内容添加到上面列出的配置文件中。

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.

请注意,对于Tomcat 7
起,使用经理所需的角色应用程序是
从单个管理员角色更改为以下四个角色。您需要为
希望访问的功能分配角色。

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 - 允许访问HTML GUI和状态页面
manager-script - 允许访问文本界面和状态
pages manager-jmx - 允许访问JMX代理和状态
pages manager-status - 允许仅访问状态页面HTML
接口受CSRF保护,但文本和JMX接口
不受保护。要维护CSRF保护:

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:

具有manager-gui角色的用户不应被授予
manager-script或manager-jmx角色。如果text或jmx接口是通过浏览器访问的
(例如,为了测试,因为这些接口
用于工具而不是人类),那么浏览器必须在
之后关闭以终止会话。有关详细信息,请参阅
Manager App HOW-TO。

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.

这是我的tomcat-users.xml:

Here is my tomcat-users.xml :

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

我正在通过intellij idea 12 ultimate运行tomcat 7。
我正在使用Mountain Lion操作系统。
谢谢。

I am running tomcat 7 through intellij idea 12 ultimate. I am using Mountain Lion operating system. Thank you.

推荐答案

我编辑了两个文件: server.xml & tomcat-users.xml

I edited two files : server.xml & tomcat-users.xml

第1步:我将此行添加到 server.xml ,此行必须添加到与图片相同的引擎上下文中:

STEP 1 : I added this line to the server.xml, this line must be added under Engine context same as the picture:

< Realm className = org.apache.catalina.realm.MemoryRealm/>

在这里你可以看到图片:

here you can see the picture :

第2步:然后我编辑了 tomcat-users.xml 并添加了以下行:

STEP 2 : then I edited tomcat-users.xml and added the lines below :

<!--
  NOTE:  The sample user and role entries below are wrapped in a 
  comment and thus are ignored when reading this file. Do not forget
  to remove <!.. ..> that surrounds them.
-->

  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <role rolename="manager"/>
  <role rolename="manager-script"/>
  <role rolename="manager-gui"/>
  <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="tomcat" roles="manager-gui,manager-script "/> 

</tomcat-users>

注意:我建议您复制并粘贴我的文本并由您的文本替换

重启tomcat,你准备好了!

Restart tomcat and you're ready to go !

这篇关于当Tomcat通过IntelliJ Idea Ultimate 12运行时,我无法访问Tomcat 7管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆