java 我的 tomcat 正在运行,但无法连接到 http://localhost:8080
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31189217/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
My tomcat is running but I can't connect to http://localhost:8080
提问by gagan
Tomcat suddenly stopped connecting to http://localhost:8080today. It was working until yesterday, and I didn't change anything. Windows - Windows 7 64 bit. Tomcat - 7.0.59. Can anyone please help.
今天Tomcat突然停止连接http://localhost:8080。它一直工作到昨天,我没有改变任何东西。Windows - Windows 7 64 位。Tomcat - 7.0.59。任何人都可以请帮忙。
Following is my server.xml
以下是我的 server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the BIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
"
”
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.59
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jan 28 2015 15:51:10 UTC
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.59.0
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\gagan_backup\Java1\Java\jdk1.6.0_17\jre
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.6.0_17-b04
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Sun Microsystems Inc.
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Tomcat\apache-tomcat-7.0.59
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Tomcat\apache-tomcat-7.0.59
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=C:\Tomcat\apache-tomcat-7.0.59\conf\logging.properties
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Tomcat\apache-tomcat-7.0.59\endorsed
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Tomcat\apache-tomcat-7.0.59
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Tomcat\apache-tomcat-7.0.59
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.io.tmpdir=C:\Tomcat\apache-tomcat-7.0.59\temp
Jul 2, 2015 12:13:05 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:\gagan_backup\Java1\Java\jdk1.6.0_17\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ora11g\client_1\bin;C:\Program Files\IBM\RationalSDLC\common;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;c:\Program Files\Microsoft SQL Server0\Tools\Binn\;c:\Program Files\Microsoft SQL Server0\DTS\Binn\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\IBM\RationalSDLC\ClearCase\bin;C:\Program Files (x86)\IBM\gsk8\lib;C:\Program Files (x86)\IBM\gsk8\bin;C:\Program Files (x86)\MIT\Kerberos\bin;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript.0\;C:\gagan_backup\Java1\Java\jdk1.6.0_17\bin;C:\ora11g\client_1\bin;C:\Program Files\IBM\RationalSDLC\common;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Microsoft\Web Platform Installer\;c:\Program Files (x86)\Microsoft SQL Server0\Tools\Binn\;c:\Program Files\Microsoft SQL Server0\Tools\Binn\;c:\Program Files\Microsoft SQL Server0\DTS\Binn\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\IBM\RationalSDLC\ClearCase\bin;C:\Program Files (x86)\IBM\gsk8\lib;C:\Program Files (x86)\IBM\gsk8\bin;C:\Program Files (x86)\MIT\Kerberos\bin;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript.0\;C:\Users\gthapar\Desktop\jar\sqljdbc_4.0\enu\auth\x86
Jul 2, 2015 12:13:05 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jul 2, 2015 12:13:05 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jul 2, 2015 12:13:05 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 343 ms
Jul 2, 2015 12:13:06 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jul 2, 2015 12:13:06 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.59
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\docs
Jul 2, 2015 12:13:06 PM org.apache.tomcat.websocket.server.WsSci onStartup
INFO: JSR 356 WebSocket (Java WebSocket 1.1) support is not available when running on Java 6. To suppress this message, run Tomcat on Java 7, remove the WebSocket JARs from $CATALINA_HOME/lib or add the WebSocket JARs to the tomcat.util.scan.DefaultJarScanner.jarsToSkip property in $CATALINA_BASE/conf/catalina.properties. Note that the deprecated Tomcat 7 WebSocket API will be available.
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\docs has finished in 181 ms
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\examples
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\examples has finished in 261 ms
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\host-manager
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\host-manager has finished in 46 ms
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\manager
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\manager has finished in 71 ms
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\ROOT
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory C:\Tomcat\apache-tomcat-7.0.59\webapps\ROOT has finished in 35 ms
Jul 2, 2015 12:13:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 2, 2015 12:13:06 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 2, 2015 12:13:06 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 624 ms
"
”
Server is running, but when I try to stop it, I get the following error. Can it provide any hint.
服务器正在运行,但是当我尝试停止它时,出现以下错误。它可以提供任何提示。
Jul 2, 2015 12:30:51 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 2, 2015 12:30:51 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at java.net.Socket.connect(Socket.java:475)
at java.net.Socket.<init>(Socket.java:372)
at java.net.Socket.<init>(Socket.java:186)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)
C:\Tomcat\apache-tomcat-7.0.59\bin>
回答by Luiggi Mendoza
回答by Robert Wadowski
Try
尝试
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" />
回答by Erwin Smout
The problem is this (read what it says - attentively) :
问题是这样的(阅读它所说的 - 用心):
Jul 2, 2015 12:30:51 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Could not contact localhost:8005. Tomcat may not be running.
2015 年 7 月 2 日下午 12:30:51 org.apache.catalina.startup.Catalina stopServer 严重:无法联系 localhost:8005。Tomcat 可能没有运行。
Tomcat listens for shutdown commands on another port than it does for http requests. The shutdown port is defined as an attribute in the element (I believe) of your server.xml. The default installation listens on port 8005. But if that attribute is removed, the server won't open that port and shutdown must proceed differently (or not at all).
Tomcat 在另一个端口上侦听关闭命令,而不是侦听 http 请求。关闭端口被定义为 server.xml 的元素(我相信)中的一个属性。默认安装侦听端口 8005。但是如果删除该属性,服务器将不会打开该端口并且关闭必须以不同的方式进行(或根本不进行)。