我即將失去理智。Eclipse中的Tomcat - HTTP狀態404請求的資源不可用
我按照這裏的教程
Java servlet tutorial for beginners
我有這個index.html文件
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
而且web.xml
文件
兩個文件在t他WebContent文件夾
我可以毫無問題運行Tomcat和
http://localhost:8080/
工作正常,但是當我運行應用程序或去
http://localhost:8080/ServletTutorial/
或
http://localhost:8080/ServletTutorial/index.html
它給404錯誤請求的資源不可用。
我已經配置Tomcat以使用Tomcat安裝。
我快要崩潰大哭......我已經困在這裏了兩天:(
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server version: Apache Tomcat/8.0.33
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server built: Mar 18 2016 20:31:49 UTC
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Server number: 8.0.33.0
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: OS Name: Windows 10
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: OS Version: 10.0
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Architecture: x86
mag 11, 2016 11:57:20 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Java Home: C:\Program Files (x86)\Java\jre1.8.0_91
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: JVM Version: 1.8.0_91-b14
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: JVM Vendor: Oracle Corporation
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: CATALINA_BASE: C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: CATALINA_HOME: C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dcatalina.base=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dcatalina.home=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dwtp.deploy=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\wtpwebapps
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Djava.endorsed.dirs=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\endorsed
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAZIONI: Command line argument: -Dfile.encoding=Cp1252
mag 11, 2016 11:57:21 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAZIONI: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre1.8.0_91\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files (x86)/Java/jre1.8.0_91/bin/client;C:/Program Files (x86)/Java/jre1.8.0_91/bin;C:/Program Files (x86)/Java/jre1.8.0_91/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\Antonio\Desktop\eclipse;;.
mag 11, 2016 11:57:21 AM org.apache.coyote.AbstractProtocol init
INFORMAZIONI: Initializing ProtocolHandler ["http-nio-8080"]
mag 11, 2016 11:57:21 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAZIONI: Using a shared selector for servlet write/read
mag 11, 2016 11:57:21 AM org.apache.coyote.AbstractProtocol init
INFORMAZIONI: Initializing ProtocolHandler ["ajp-nio-8009"]
mag 11, 2016 11:57:21 AM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFORMAZIONI: Using a shared selector for servlet write/read
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.Catalina load
INFORMAZIONI: Initialization processed in 1246 ms
mag 11, 2016 11:57:21 AM org.apache.catalina.core.StandardService startInternal
INFORMAZIONI: Starting service Catalina
mag 11, 2016 11:57:21 AM org.apache.catalina.core.StandardEngine startInternal
INFORMAZIONI: Starting Servlet Engine: Apache Tomcat/8.0.33
mag 11, 2016 11:57:21 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\docs
mag 11, 2016 11:57:22 AM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFORMAZIONI: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [224] milliseconds.
mag 11, 2016 11:57:22 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deployment of web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\docs has finished in 730 ms
mag 11, 2016 11:57:22 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\examples
mag 11, 2016 11:57:23 AM org.apache.catalina.core.ApplicationContext log
INFORMAZIONI: ContextListener: contextInitialized()
mag 11, 2016 11:57:23 AM org.apache.catalina.core.ApplicationContext log
INFORMAZIONI: SessionListener: contextInitialized()
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deployment of web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\examples has finished in 857 ms
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\host-manager
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deployment of web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\host-manager has finished in 57 ms
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\manager
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deployment of web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\manager has finished in 62 ms
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deploying web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\ROOT
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFORMAZIONI: Deployment of web application directory C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\ROOT has finished in 31 ms
mag 11, 2016 11:57:23 AM org.apache.coyote.AbstractProtocol start
INFORMAZIONI: Starting ProtocolHandler ["http-nio-8080"]
mag 11, 2016 11:57:23 AM org.apache.coyote.AbstractProtocol start
INFORMAZIONI: Starting ProtocolHandler ["ajp-nio-8009"]
mag 11, 2016 11:57:23 AM org.apache.catalina.startup.Catalina start
INFORMAZIONI: Server startup in 1834 ms
這兩個文件都在WebContent文件夾中 - 實際上web.xml必須位於WebContent/WEB-INF文件夾中。 – ike3
我想輸入xml文件代碼,但它不允許我0_o – NoobNe0
沒有得到最後的評論。有沒有錯誤? – ike3