我在我的 Windows 7 机器上安装了 Tomcat 7.0。它似乎运行正常:它在 Eclipse 上启动。以下是控制台上的整个日志:
Jun 30, 2013 10:16:25 PM org.apache.catalina.core.AprLifecycleListener init
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\jre7\bin;C:\windows\Sun\Java\bin;C:\windows\system32;C:\windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Windows Live\Shared;C:\Program Files\Java\jdk1.7.0_07\bin; C:\Program Files\Java\jre6\bin; c:\Borland\Bcc55\bin; C:\MinGW\bin; C:\MinGW\MSYS\1.0\local\bin; C:\MinGW\MSYS\1.0\bin; C:\MinGW\MSYS\1.0; C:\MSYS\1.0; C:\MinGW\lib\gcc\mingw32\4.6.2\include\c++\bits; C:\MinGW\MSYS\1.0\home\boost\boost_1_51_0; c:\Users\AYSE\apache-tomcat-7.0.40\bin; c:\Users\AYSE\apache-tomcat-7.0.40; c:\Users\AYSE\apache-tomcat-7.0.40\lib; ;C:\Users\AYSE\Downloads\eclipse;;.
Jun 30, 2013 10:16:28 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 30, 2013 10:16:28 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 30, 2013 10:16:28 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 4825 ms
Jun 30, 2013 10:16:28 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 30, 2013 10:16:28 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Jun 30, 2013 10:16:30 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [290] milliseconds.
Jun 30, 2013 10:16:30 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 30, 2013 10:16:30 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 30, 2013 10:16:30 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1993 ms
它也在 Windows 上正常启动。
但是,当我尝试打开 URL
http://localhost:8080/
在浏览器中,我收到一条 HTTP 404 错误消息,表明请求的源不可用。
我按照http://www.coreservlets.com/Apache-Tomcat-Tutorial/tomcat-7-with-eclipse.html上的说明进行安装。我还尝试了默认设置中的端口 80。
它正在运行以执行基本的 servlet。
我错过了什么???
//================================================= ===============================
更新:
我从此更改了 Eclipse 上的服务器位置
"Use workspace metadata (does not modify Tomcat installation)"
至
"Use Tomcat installation (takes control of Tomcat installation)".
这一次,当我尝试从 Eclipse 启动 Tomcat 时,我在弹出窗口中收到以下错误消息:
Server apache-tomcat-7.0.40 at localhost was unable to start within 45 seconds. If the server requires more time, try increasing the timeout in the server editor.
并且 Eclipse 控制台上的日志是
Jun 30, 2013 10:46:00 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:
<... the contents of my PATH environment variable...>
然而,
Tomcat 解压文件的 bin 文件夹在 PATH 中。不仅如此,我还在路径中添加了基本的 Tomcat 文件夹和 \lib 文件夹。
//================================================= ===============================
更新:重新启动 Eclipse 并工作!
仍然不知道那里出了什么问题。
我猜会使用“小心”一段时间。