问题描述
我在 Eclipse 中的 8085 端口上配置了 Tomcat 6.0.24 并成功启动,日志如下:
I configured Tomcat 6.0.24 in Eclipse on port 8085 and started successfully with log as below:
Feb 17, 2010 4:24:31 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 FilesJavajre6in;.;C:WINDOWSSunJavain;C:WINDOWSsystem32;C:WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;E:oracleproduct10.2.0client_1in;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSsystem32WBEM;C:Program FilesMicrosoft SQL Server80ToolsBINN;C:Program FilesCommon FilesTeleca Shared;C:Program FilesMicrosoft SQL Server90Toolsinn;E:Program FilesMicrosoft Visual Studio 8Common7IDEPrivateAssemblies;C:Program FilesMySQLMySQL Server 5.0in;E:komal-gohil oolsSubversionin;C:SunSDKin;e:instantrails
ubyin;c:program filesjavajdk1.6.0_11in;E:komal-gohil oolsapache-maven-2.2.1in;C:program filesjavajdk1.6.0_11in;E:komal-gohil oolsAntin;E:komal-gohil oolsapache-tomcat-5.5.17in;C:SunSDKlibj2ee.jar;E:komal-gohil oolsandroid-sdk-windows-1.6_r1 ools;E:komal-gohil oolsScalain;E:komal-gohil oolspax-construct-1.4in
Feb 17, 2010 4:24:31 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8085
Feb 17, 2010 4:24:31 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 705 ms
Feb 17, 2010 4:24:32 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 17, 2010 4:24:32 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Feb 17, 2010 4:24:32 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8085
Feb 17, 2010 4:24:32 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8010
Feb 17, 2010 4:24:32 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Feb 17, 2010 4:24:32 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 421 ms
但是当我尝试在 webbrowser 中打开 http://localhost:8085
时,它给了我以下错误:
But when I am trying to open http://localhost:8085
in webbrowser, it is giving me the following error:
输入状态报告
消息/
描述请求的资源 (/) 不可用.
description The requested resource (/) is not available.
Apache Tomcat/6.0.24
Apache Tomcat/6.0.24
当我在 Eclipse 之外启动 Tomcat 时,我可以在 webbrowser 中打开 http://localhost:8085
.
When I start Tomcat outside the Eclipse, then I can just open http://localhost:8085
in webbrowser.
这可能是什么原因?我该如何解决这个问题?
What could be the reason for this? How do I solve this problem?
推荐答案
你在期待什么?默认的Tomcat主页?如果是这样,您需要配置 Eclipse 以从 Tomcat 接管控制.
What are you expecting? The default Tomcat homepage? If so, you'll need to configure Eclipse to take control over from Tomcat.
双击Servers 选项卡中的Tomcat 服务器条目,您将获得服务器配置.在左列的服务器位置下,选择使用 Tomcat 安装.这样 Eclipse 将完全控制 Tomcat,这样当从 Eclipse 内部运行时,您还可以使用 Tomcat 管理器访问默认的 Tomcat 主页.我只是不明白这在使用 Eclipse 进行开发时有什么用处.
Doubleclick the Tomcat server entry in the Servers tab, you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation. This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. I only don't see how that's useful while developing using Eclipse.
注意,当它变灰时,阅读部分前导文本!它的字面意思是必须在不存在模块的情况下发布服务器才能进行更改".换句话说,请确保您已通过右键单击服务器和添加和删除... 选项删除所有模块,然后执行右键单击服务器和发布.
Note, when it is grayed out, read the section leading text! It literally says "Server must be published with no modules present to make changes". In other words, make sure that you've removed all modules via rightclick server and Add and remove... option, and then performed rightclick server and Publish.
端口号不是问题.否则你会在 Tomcat 的启动日志中得到一个异常,并且浏览器会显示一个特定于浏览器的连接超时".错误页面,因此不是特定于 Tomcat 的错误页面,当 Tomcat 未启动和运行时不可能提供该错误页面.
The port number is not the problem. You would otherwise have gotten an exception in Tomcat's startup log, and the browser would show a browser-specific "Connection timed out" error page and thus not a Tomcat-specific error page which could impossibly be served when Tomcat was not up and running.
这篇关于Tomcat 在 Eclipse 中启动但无法连接到 http://localhost:8085/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!