简体   繁体   中英

Cannot connect to instance of Tomcat 6 started in Eclipse

I am running 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. 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).

Here is the Eclipse trace:

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:

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? If yes, how do I fix it so that the Eclipse server uses the same library as the console?

APR is not a problem. 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).

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 . Then save, restart the server and you'll be able to access localhost without any app deployed on it.

PS There is a more detailed explanation already here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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