404错误,Tomcat首页都打不开
D:\apache-tomcat-8.5.43\bin\catalina.bat run [2019-10-30 05:00:41,618] Artifact icake:war exploded: Waiting for server connection to start artifact deployment... Using CATALINA_BASE: "C:\Users\WZW\.IntelliJIdea2019.1\system\tomcat\Unnamed_icake_3" Using CATALINA_HOME: "D:\apache-tomcat-8.5.43" Using CATALINA_TMPDIR: "D:\apache-tomcat-8.5.43\temp" Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_201" Using CLASSPATH: "D:\apache-tomcat-8.5.43\bin\bootstrap.jar;D:\apache-tomcat-8.5.43\bin\tomcat-juli.jar" Connected to the target VM, address: '127.0.0.1:33648', transport: 'socket' 30-Oct-2019 17:00:44.715 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.43 30-Oct-2019 17:00:44.718 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jul 4 2019 20:53:15 UTC 30-Oct-2019 17:00:44.718 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.43.0 30-Oct-2019 17:00:44.718 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10 30-Oct-2019 17:00:44.719 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0 30-Oct-2019 17:00:44.719 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64 30-Oct-2019 17:00:44.719 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_201\jre 30-Oct-2019 17:00:44.720 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_201-b09 30-Oct-2019 17:00:44.720 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation 30-Oct-2019 17:00:44.720 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\WZW\.IntelliJIdea2019.1\system\tomcat\Unnamed_icake_3 30-Oct-2019 17:00:44.720 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: D:\apache-tomcat-8.5.43 30-Oct-2019 17:00:44.721 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\WZW\.IntelliJIdea2019.1\system\tomcat\Unnamed_icake_3\conf\logging.properties 30-Oct-2019 17:00:44.721 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 30-Oct-2019 17:00:44.721 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:33648,suspend=y,server=n 30-Oct-2019 17:00:44.721 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:C:\Users\WZW\.IntelliJIdea2019.1\system\captureAgent\debugger-agent.jar 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote= 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.password.file=C:\Users\WZW\.IntelliJIdea2019.1\system\tomcat\Unnamed_icake_3\jmxremote.password 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.access.file=C:\Users\WZW\.IntelliJIdea2019.1\system\tomcat\Unnamed_icake_3\jmxremote.access 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1 30-Oct-2019 17:00:44.723 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048 30-Oct-2019 17:00:44.724 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 30-Oct-2019 17:00:44.726 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs= 30-Oct-2019 17:00:44.727 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\WZW\.IntelliJIdea2019.1\system\tomcat\Unnamed_icake_3 30-Oct-2019 17:00:44.727 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\apache-tomcat-8.5.43 30-Oct-2019 17:00:44.727 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\apache-tomcat-8.5.43\temp 30-Oct-2019 17:00:44.727 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.7.0]. 30-Oct-2019 17:00:44.727 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 30-Oct-2019 17:00:44.727 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 30-Oct-2019 17:00:44.735 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1c 28 May 2019] 30-Oct-2019 17:00:45.116 淇℃伅 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"] 30-Oct-2019 17:00:45.146 淇℃伅 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 30-Oct-2019 17:00:45.176 淇℃伅 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"] 30-Oct-2019 17:00:45.184 淇℃伅 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read 30-Oct-2019 17:00:45.185 淇℃伅 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 1186 ms 30-Oct-2019 17:00:45.255 淇℃伅 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina] 30-Oct-2019 17:00:45.256 淇℃伅 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.43 30-Oct-2019 17:00:45.272 淇℃伅 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"] 30-Oct-2019 17:00:45.291 淇℃伅 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"] 30-Oct-2019 17:00:45.302 淇℃伅 [main] org.apache.catalina.startup.Catalina.start Server startup in 117 ms Connected to server [2019-10-30 05:00:45,436] Artifact icake:war exploded: Artifact is being deployed, please wait... 30-Oct-2019 17:00:47.690 淇℃伅 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. [2019-10-30 05:00:47,849] Artifact icake:war exploded: Artifact is deployed successfully [2019-10-30 05:00:47,849] Artifact icake:war exploded: Deploy took 2,414 milliseconds 30-Oct-2019 17:00:55.288 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [D:\apache-tomcat-8.5.43\webapps\manager] 30-Oct-2019 17:00:55.437 淇℃伅 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 30-Oct-2019 17:00:55.456 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [D:\apache-tomcat-8.5.43\webapps\manager] has finished in [167] ms
11
收起
正在回答 回答被采纳积分+1
5回答
芝芝兰兰
2019-10-31 10:57:08
同学你好。既然产生了楼下的404页面。Tomcat本身是没有问题的。
注意出现404页面和出现白屏的情况不同。一般来说,白屏的情况有几种可能:
1)项目没有成功发布到Tomcat中
2)Servlet运行时控制台console报错
3)Servlet跳转失败
4)页面留在了Servlet没有跳转等等。
综上同学的需要先看一下请求对应的流程上是否有卡住的
1、可以对比检查一下GlobalController是否有拼写错误,这里的路径是否不匹配 :
package com.imooc.icake.global; import javax.servlet.GenericServlet; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; public class GlobalController extends GenericServlet { public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException { /* .do /login.do DefaultController login /Cake/detail.do CakeController detail /admin/Cake/add.do CakeController add */ HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse)servletResponse; String path = request.getServletPath(); if(path.indexOf("/admin")!=-1){ path = path.substring(7); }else{ path = path.substring(1); } /* login.do DefaultController login Cake/detail.do CakeController detail Cake/add.do CakeController add */ int index = path.indexOf("/"); String className =null; String methodName =null; if(index!=-1){ className = "com.imooc.icake.controller."+path.substring(0,index)+"Controller"; methodName = path.substring(index+1,path.indexOf(".do")); }else{ className = "com.imooc.icake.controller.DefaultController"; methodName = path.substring(0,path.indexOf(".do")); } try { Class cla = Class.forName(className); Object object = cla.newInstance(); Method method = cla.getMethod(methodName,HttpServletRequest.class, HttpServletResponse.class); method.invoke(object,request,response); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }
2、检查下对应的方法是否已经实现,转发是否写错,是否漏写了forword:
3、页面对应的路径是否能找到:
祝学习愉快~
3. Java 数据库开发与实战应用
- 参与学习 人
- 提交作业 357 份
- 解答问题 8016 个
本阶段将带你学习MySQL数据库,JDBC接口,MyBatis框架等,带你掌握的数据的存放和管理。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星