Tomcat8.5管理页面403 Access Denied的解决方法

安装tomcat之后,访问server status、manager app、host manager等页面,出现403 Access Denied错误,
 

image  

 

解决方法:

1.  在conf/tomcat-users.xml文件里面,在</tomcat-users>前面添加如下代码:

          <role rolename="manager-gui"/>

         <user username="tomcat" password="admin888" roles="manager-gui"  />

      注:如果要访问host manager,还需要做一些修改,改成如下:

          <role rolename="manager-gui"/>

          <role rolename="admin-gui"/>

         <user username="aerchi" password="aerchi.com" roles="manager-gui,admin-gui"  />

     然后重启tomcat,重新访问manager app页面,如果此时仍然出现403 Access Denied错误,

     那么就是访问的ip地受到了限制,

 

2.  我们打开webapps/manager/META-INF/目录下context.xml文件,不是conf/目录下的context.xml文件

我们将里面的内容注释掉或者修改

<!--aerchi.com-->
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="192\.168\.128\.\d+|127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />

表示:允许本地回环地址及192.168.128.0网段访问,你需要修改为你访问网段的地址或者具体的IP。

比如:所在网段是192.168.1.0,可以写成192\.168\.1\.\d+;或者允许192.168.1.100访问,写成192\.168\.1\.100

 

注:如果要访问host manager,还需要修改webapps/host-manager/META-INF/目录下的context.xml文件,修改内容和上面一样。

保存,然后重启tomcat,重新访问server status、manager app页面,输出上面设置的用户名和密码,即可访问页面。

image


Tomcat 的路径重写:

首先有一个可以在tomcat上运行的webapp,你的server.xml(位于$CATALINA_HOME/conf/)<Host>标签正常应该是这样的:

<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &quot;%r&quot; %s %b" prefix="localhost_access_log" suffix=".txt"/>
</Host>


在server.xml配置webapp重写机制,在server.xml里的<Host>标签配置如下context 标签: 
docBase 代表重定向路径,
path代表访问相对路径。

<Context docBase="YourWebName" path="/" reloadable="true" crossContext="true">
    <Valve className="org.apache.catalina.valves.rewrite.RewriteValve"/>
</Context>

Or
<Context path="/aerchi/run" docBase="E:/WebServer/apache-tomcat/webapps/aerchi" reloadable="true"></Context>

乐意黎
 

发布了430 篇原创文章 · 获赞 415 · 访问量 925万+
展开阅读全文

403Access Denied??怎么改

03-31

我在myeclipse做了一个网站,然后输入http://127.0.0.1:8080/manager/login.jsp。 出现错误如下: 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. 我按照这错误在配置中改了,也添加了,<tomcat-users> <role rolename="manager"/> <role rolename="manager-gui"/> <role rolename="admin"/> <role rolename="admin-gui"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/> <user username="Tomcat" password="Tomcat" roles="admin-gui,admin,manager,manager-script,manager-jmx,manager-status"/> <user username="tomcat" password="s3cret" roles="manager-gui"/> 可以进入tomcat manager APP.但是我的工程manager.login.jsp还是进不去啊 问答

tomcat8.5 在linux启动报错

08-26

java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) ... 6 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@718984cc] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4860) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4992) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more Caused by: java.lang.IllegalArgumentException: The main resource set specified [/GGS] is not valid at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:745) at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:703) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 9 more 26-Aug-2017 08:34:19.913 严重 [main] org.apache.catalina.core.ContainerBase.startInternal A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.util.concurrent.FutureTask.get(FutureTask.java:192) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Catalina.start(Catalina.java:656) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more 26-Aug-2017 08:34:19.913 严重 [main] org.apache.catalina.startup.Catalina.start The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.startup.Catalina.start(Catalina.java:656) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 9 more Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more 26-Aug-2017 08:34:19.914 信息 [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-80"] 26-Aug-2017 08:34:19.914 信息 [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"] 26-Aug-2017 08:34:19.914 信息 [main] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina] 26-Aug-2017 08:34:19.916 信息 [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-80"] 26-Aug-2017 08:34:19.918 信息 [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"] ![图片说明](https://img-ask.csdn.net/upload/201708/26/1503708296_324075.png) 没启动起来 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览