老师:页面显示404可能原因有哪些,该怎么排查,实在找不出了,谢谢!(直接去index是没问题的)
<welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>home.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list>
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Title</title> </head> <body> <% response.sendRedirect("/index"); %> </body> </html>
@WebServlet("/index") public class UserFindServlet extends HttpServlet { private usersDAO usersDAO = new usersDAO(); @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { this.doPost(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { List<Users> list = usersDAO.findAll(); req.setAttribute("usersList", list); req.getRequestDispatcher("index.jsp").forward(req, resp); System.out.println("UserFindServlet。doPost运行了"); } }
@WebListener public class InitSqlSessionListener implements ServletContextListener { public void contextInitialized(ServletContextEvent servletContextEvent) { System.out.println("容器加载中。。。"); //容器初始化方法 初始化我们的SqlSessionFactory对象 SqlSessionFactoryUtils.initSqlSessionFactory(); } public void contextDestroyed(ServletContextEvent servletContextEvent) { System.out.println("容器销毁中。。。"); //容器销毁时 关闭SqlSession对象 SqlSessionFactoryUtils.close(); } }
"C:\Program Files\apache-tomcat-9.0.12\bin\catalina.bat" run
[2018-11-23 06:06:42,103] Artifact myjavaee:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\18366\.IntelliJIdea2018.2\system\tomcat\Unnamed_myjavaee"
Using CATALINA_HOME: "C:\Program Files\apache-tomcat-9.0.12"
Using CATALINA_TMPDIR: "C:\Program Files\apache-tomcat-9.0.12\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk-10.0.2"
Using CLASSPATH: "C:\Program Files\apache-tomcat-9.0.12\bin\bootstrap.jar;C:\Program Files\apache-tomcat-9.0.12\bin\tomcat-juli.jar"
23-Nov-2018 18:06:43.045 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/9.0.12
23-Nov-2018 18:06:43.049 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 4 2018 22:13:41 UTC
23-Nov-2018 18:06:43.049 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 9.0.12.0
23-Nov-2018 18:06:43.050 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
23-Nov-2018 18:06:43.050 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
23-Nov-2018 18:06:43.050 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
23-Nov-2018 18:06:43.050 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk-10.0.2
23-Nov-2018 18:06:43.050 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 10.0.2+13
23-Nov-2018 18:06:43.050 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: "Oracle Corporation"
23-Nov-2018 18:06:43.051 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\18366\.IntelliJIdea2018.2\system\tomcat\Unnamed_myjavaee
23-Nov-2018 18:06:43.051 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: C:\Program Files\apache-tomcat-9.0.12
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\18366\.IntelliJIdea2018.2\system\tomcat\Unnamed_myjavaee\conf\logging.properties
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
23-Nov-2018 18:06:43.052 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\18366\.IntelliJIdea2018.2\system\tomcat\Unnamed_myjavaee
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=C:\Program Files\apache-tomcat-9.0.12
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=C:\Program Files\apache-tomcat-9.0.12\temp
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.17] using APR version [1.6.3].
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
23-Nov-2018 18:06:43.053 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
23-Nov-2018 18:06:43.540 信息 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.0.2o 27 Mar 2018]
23-Nov-2018 18:06:43.579 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
23-Nov-2018 18:06:43.592 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-Nov-2018 18:06:43.599 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
23-Nov-2018 18:06:43.601 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
23-Nov-2018 18:06:43.601 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 833 ms
23-Nov-2018 18:06:43.649 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
23-Nov-2018 18:06:43.649 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/9.0.12
23-Nov-2018 18:06:43.657 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
23-Nov-2018 18:06:43.671 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
23-Nov-2018 18:06:43.673 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 71 ms
Connected to server
[2018-11-23 06:06:43,747] Artifact myjavaee:war exploded: Artifact is being deployed, please wait...
23-Nov-2018 18:06:44.378 信息 [RMI TCP Connection(3)-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.
容器加载中。。。
SqlSessionFactoryUtils。init运行了
[2018-11-23 06:06:44,707] Artifact myjavaee:war exploded: Artifact is deployed successfully
[2018-11-23 06:06:44,708] Artifact myjavaee:war exploded: Deploy took 961 milliseconds
23-Nov-2018 18:06:53.660 信息 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [C:\Program Files\apache-tomcat-9.0.12\webapps\manager]
23-Nov-2018 18:06:53.750 信息 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\Program Files\apache-tomcat-9.0.12\webapps\manager] has finished in [90] ms
正在回答 回答被采纳积分+1
- 参与学习 人
- 提交作业 277 份
- 解答问题 4297 个
Java数据库开发的必备技能,从流行的MySQL数据库开始,到Java原生的数据库管理接口JDBC的使用,再到常用的数据持久化框架MyBatis,让你向Java工程师的目标又迈进了一步!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星