Tomcat调试404错误

开篇附上我找到的部分解决方法摘自:https://blog.csdn.net/psp0001060/article/details/51879232

如不想跳转查看,链接内容如下:

问题一:
           指定目录下没有访问的文件,这是最常见的,也是最容易解决的。只需要将访问的文件(如:a.html)放到指定目录下即可。

问题二:
         将访问的文件(如:b.html)放到了webapps的根目录下,然后访问http://localhost:8080/b.html,这种方式也会造成404错误,               解决方法是在webapps下新建一个目录(如:test),然后将b.html 放到test目录里面。访问网址  http://localhost:8080/test/b.html

问题三:
         访问的目录下的web.xml 文件内容有误。解放方法是可以直接删除web.xml或写入下面的内容

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>ss</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
</web-app>

问题四:

       在win10系统中需要获取系统权限后,才能运行。在bin目录下,右键tomcat7w.exe,【管理员取得所有权】,然后就可以运行。

————————————————————我是分割线————————————————————————————————

以上方法于我没用

这里先讲述一下自己的情况:

我的Tomcat配置的端口是8080

由于我在eclipse中已经打开了Tomcat,此时8080端口被eclipse占用

所以浏览器中的Tomcat不能正常运行,出现404错误

我把eclipse关闭了以后在打开Monitor Tomcat 开启Tomcat服务

这样就成功打开j配置好Tomcat Service了

当然也可以打开jsp文件了

Tomcat的访问目录是安装目录下的Tomcat 9.0\webapps\ROOT

只有把要访问的文件放在ROOT下即可通过localhost的8080端口访问文件

好了,我的问题解决了,你的呢?

猜你喜欢

转载自www.cnblogs.com/JaFlower/p/10043774.html