我将Tomcat 8.5与Eclipse集成,但是当我启动服务器并转到http://localhost:8080或http://localhost:8080/psite(使用index.html配置的Eclipse项目)时,我每次都会收到404错误。
-
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.5.11
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jan 10 2017 21:02:52 UTC
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.5.11.0
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 10
Feb 16, 2017 3:41:30 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.0
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jdk1.8.0_121\jre
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_121-b13
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Program Files\Apache Software Foundation\Tomcat 8.5
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 8.5
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 8.5\endorsed
Feb 16, 2017 3:41:31 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Feb 16, 2017 3:41:31 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: 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\Java\jdk1.8.0_121\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre1.8.0_121/bin/server;C:/Program Files/Java/jre1.8.0_121/bin;C:/Program Files/Java/jre1.8.0_121/lib/amd64;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;;C:\Users\Nadav\eclipse\java-neon\eclipse;;.
Feb 16, 2017 3:41:31 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Feb 16, 2017 3:41:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Feb 16, 2017 3:41:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
Feb 16, 2017 3:41:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Feb 16, 2017 3:41:32 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1436 ms
Feb 16, 2017 3:41:32 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 16, 2017 3:41:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.11
Feb 16, 2017 3:41:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [http-nio-8080]
Feb 16, 2017 3:41:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler [ajp-nio-8009]
Feb 16, 2017 3:41:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 246 ms
从Workspace.metadata.plugins \ org.eclipse.wst.server.core \ tmp0 \ logs"
记录127.0.0.1 - - [16/Feb/2017:15:37:39 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:15:37:43 +0200] "GET / HTTP/1.1" 404 988
127.0.0.1 - - [16/Feb/2017:15:40:57 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:15:40:59 +0200] "GET / HTTP/1.1" 404 988
127.0.0.1 - - [16/Feb/2017:15:41:32 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:15:41:34 +0200] "GET / HTTP/1.1" 404 988
127.0.0.1 - - [16/Feb/2017:16:06:00 +0200] "GET / HTTP/1.1" 404 988
0:0:0:0:0:0:0:1 - - [16/Feb/2017:16:06:06 +0200] "GET /manager HTTP/1.1" 404 1002
答案 0 :(得分:1)
当您从eclipse启动tomcat时,它会更改CATALINA_BASE:
-Dcatalina.base=C:\Users\Nadav\Desktop\Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
这样,你永远不会在eclipse中运行管理器应用程序:它完全是空的。默认情况下,您部署了一个空的ROOT应用程序。现在,我怀疑您尚未在“服务器”视图中将您的应用添加到服务器(右键单击您的tomat并选择"添加或删除")。控制台输出应该提到在这种情况下部署了psite。您还可以访问catalina基本文件夹并查看应用的 wtpwebapps 文件夹。
答案 1 :(得分:0)
试试这个。
确保您已使用server view>add
或Run As->在服务器上运行
现在让package explorer(或)项目资源管理器找到Server文件夹。
展开它,然后在tomcat8.5的文件夹中找到server.xml
。
现在打开sever.xml,在文件末尾确保您已完成此配置。
<Context docBase="psite" path="/psite" reloadable="true" source="org.eclipse.jst.j2ee.server:psite"/>
如果没有停止服务器修改它并启动服务器然后尝试。