Tomcat404错误:All URLs used to access the Manager application should now start with one of the followi

本文解决了在使用SSM框架和Tomcat 9.0.6时遇到的问题,即访问特定Controller路径时出现404错误。问题在于部分路径与Tomcat内部管理应用的路径冲突,通过更改Controller中的路径映射解决了该问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境:

IDE:idea 2017.02

server:Tomcat 9.0.6

框架:ssm + redis


错误现象:

ssm框架下,request的映射路径没有问题,控制台也没有抛出异常,主页能正常打开,但是不能跳转到Controller的路径,

报了以下错误:

The page you tried to access (/manager/text/sessions) does not exist.

The Manager application has been re-structured for Tomcat 7 onwards and some of URLs have changed. All URLs used to access the Manager application should now start with one of the following options:

/manager/html for the HTML GUI
/manager/text for the text interface
/manager/jmxproxy for the JMX proxy
/manager/status for the status pages
Note that the URL for the text interface has changed from "/manager" to "/manager/text".

You probably need to adjust the URL you are using to access the Manager application. However, there is always a chance you have found a bug in the Manager application. If you are sure you have found a bug, and that the bug has not already been reported, please report it to the Apache Tomcat team.

Tomcat找不到页面,Manager Application在Tomcat7中做了更新,所有访问Manager Application的URL必须以下列之一开头,访问的URL不正确,导致找不到页面。


原因猜测:

网上查了一下,只找到一个帖子:https://stackoverflow.com/questions/36462764/accessing-tomcat-manager-throws-404

他给了解决方法,在Tomcat路径下找到配置文件,context.xml,增加一句:

<!-- The contents of this file will be loaded for each web application -->
<Context privileged="true">

    <!-- Default set of monitored resources. If one of these changes, the    -->
    <!-- web application will be reloaded. 

加上一句<Context privileged="true">,说是Tomcat权限问题,没仔细研究过,直接改了配置文件,但是没有用。


我的解决方法和一点猜想:

看日志的信息表达的意思可能是因为/manager....是访问Tomcat内部的配置的路径?我看到之前那个人的访问路径也有/manager..,比如http://localhost:8080/manager/html....是访问Tomcat的某个管理项的,其他类似,相当于manager在路径里是不能用的。

于是我改了Controller类里映射路径,把@RequestMapping("/manager")里的"/manager"换成其他字符串,

然后重新启动Tomcat就能正常访问了。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值