安装Tomcat 9后的HTTP状态404

时间:2019-01-10 06:08:48

标签: tomcat

我在主目录中下载并解压缩了Tomcat,然后在Eclipse中配置了Tomcat,并从“服务器”选项卡中启动了实例。当我尝试打开localhost:8080时,出现以下消息,出现Http Status 404错误:源服务器未找到目标资源的当前表示形式,或不愿意透露该资源的存在。为什么默认应用程序无法加载?

Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name:   Apache Tomcat/9.0.14
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Dec 6 2018 21:13:53 UTC
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.14.0
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 7
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            6.1
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          amd64
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files\Java\jdk-11.0.1
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           11.0.1+13-LTS
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         C:\Users\hendre\Documents\FileSystem\Lot 24 Media\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Users\hendre\apache-tomcat-9.0.14
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\hendre\Documents\FileSystem\Lot 24 Media\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\hendre\apache-tomcat-9.0.14
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\hendre\Documents\FileSystem\Lot 24 Media\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Jan 10, 2019 7:55:45 AM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Jan 10, 2019 7:55:45 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Loaded APR based Apache Tomcat Native library [1.2.19] using APR version [1.6.5].
Jan 10, 2019 7:55:45 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Jan 10, 2019 7:55:45 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
Jan 10, 2019 7:55:46 AM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized [OpenSSL 1.1.1a  20 Nov 2018]
Jan 10, 2019 7:55:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Jan 10, 2019 7:55:48 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Jan 10, 2019 7:55:48 AM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [12,250] milliseconds
Jan 10, 2019 7:55:48 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Jan 10, 2019 7:55:48 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.14]
Jan 10, 2019 7:55:49 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Jan 10, 2019 7:55:49 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
Jan 10, 2019 7:55:49 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in [1,164] milliseconds

1 个答案:

答案 0 :(得分:0)

默认情况下,Eclispe将新Tomcat实例的Server Location配置为Use workspace metadata。 您将在工作区的文件夹.metadata\.plugins\org.eclipse.wst.server.core\tmp0下找到该文件夹​​

您将在其中找到一个名为webapps的文件夹,该文件夹为空。因此,根本没有部署任何应用程序,Tomcat只能对任何HTTP请求发出404响应。

您可以将下载的apache-tomcat.zip/webapps文件夹中的应用程序复制到您的Eclipse webapps文件夹中: C:\Users\hendre\Documents\FileSystem\Lot 24 Media\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps

或者,您可以将Server Location设置切换为Use Tomcat Installation

顺便说一句: 如果您从Eclipse内部开发Web应用程序并将其添加到Tomcat实例,则将其部署到wtpwebapps-在您的情况下: C:\Users\hendre\Documents\FileSystem\Lot 24 Media\Eclipse Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps