简体   繁体   English

无法连接到在Eclipse中启动的Tomcat 6实例

[英]Cannot connect to instance of Tomcat 6 started in Eclipse

I am running Tomcat 6.0.36. 我正在运行Tomcat 6.0.36。 The server runs fine when run standalone in the console. 在控制台中独立运行时,服务器运行良好。 I also configured Eclipse to be able to run it so that I can debug. 我还配置了Eclipse使其能够运行,以便可以调试。 The configuration went through successfully with no errors. 配置成功完成,没有错误。 However, when I ran the server, I was unable to access http://localhost:8080 in a browser (get a 404). 但是,当我运行服务器时,无法在浏览器中访问http://localhost:8080 (获取404)。

Here is the Eclipse trace: 这是Eclipse跟踪:

Feb 27, 2013 6:02:53 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: <my path>
Feb 27, 2013 6:02:53 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 27, 2013 6:02:53 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 294 ms
Feb 27, 2013 6:02:53 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 27, 2013 6:02:53 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Feb 27, 2013 6:02:53 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 27, 2013 6:02:53 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Feb 27, 2013 6:02:53 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/16  config=null
Feb 27, 2013 6:02:53 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 164 ms

The console trace is as follows: 控制台跟踪如下:

Feb 27, 2013 6:02:00 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.23 using APR version 1.4.6.
Feb 27, 2013 6:02:00 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Feb 27, 2013 6:02:01 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized with version OpenSSL 1.0.0g 18 Jan 2012
Feb 27, 2013 6:02:01 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 27, 2013 6:02:01 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8009
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1026 ms
Feb 27, 2013 6:02:01 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 27, 2013 6:02:01 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.36
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor host-manager.xml
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor manager.xml
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Feb 27, 2013 6:02:01 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Feb 27, 2013 6:02:01 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8009
Feb 27, 2013 6:02:01 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 341 ms

The first thing I noticed is the 2nd line from the Eclipse trace: 我注意到的第一件事是Eclipse跟踪的第二行:

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path

while the well functioning console trace reports 而功能良好的控制台跟踪报告

INFO: Loaded APR based Apache Tomcat Native library 1.1.23 using APR version 1.4.6.

Is APR indeed the problem? APR确实是问题所在吗? If yes, how do I fix it so that the Eclipse server uses the same library as the console? 如果是,如何解决它,以便Eclipse服务器使用与控制台相同的库?

APR is not a problem. APR不是问题。 When you start tomcat from eclipse, eclipse 'overrides' some server configuration (also you can change config files directly from eclipse in the 'Server' project under package/project explorer). 当您从eclipse启动tomcat时,eclipse会“覆盖”某些服务器配置(您也可以直接从eclipse更改程序包/项目浏览器下“服务器”项目中的配置文件)。

If you want to access root of your tomcat you can double click on the server (when all projects are removed) and select the configuration that says Takes control of Tomcat installation . 如果要访问tomcat的根目录,则可以双击服务器(在删除所有项目后),然后选择表示Takes control of Tomcat installation的配置。 Then save, restart the server and you'll be able to access localhost without any app deployed on it. 然后保存,重新启动服务器,您将可以在未部署任何应用程序的情况下访问localhost

PS There is a more detailed explanation already here PS还有一个更详细的解释已经在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM