我的tomcat正在运行但我无法连接到http:// localhost:8080

时间:2015-07-02 15:51:59

标签: java tomcat

Tomcat今天突然停止连接到http://localhost:8080。它一直工作到昨天,我没有改变任何东西。 Windows - Windows 7 64位。 Tomcat - 7.0.59。任何人都可以帮忙。

以下是我的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 Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\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 Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.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 Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\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 Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.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

服务器正在运行,但是当我尝试停止它时,我收到以下错误。它可以提供任何提示。

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>

3 个答案:

答案 0 :(得分:1)

看起来其他应用正在使用该端口(它可能是另一个正在运行的tomcat实例或其他应用程序)。使用netstat -anob(如图所示检查here)查找罪魁祸首并将其关闭。

答案 1 :(得分:0)

尝试

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000" />

答案 2 :(得分:0)

问题是这样的(认真阅读它的内容):

2015年7月2日,下午12:30:51 org.apache.catalina.startup.Catalina stopServer 严重:无法联系localhost:8005。 Tomcat可能未运行。

Tomcat监听另一个端口上的关闭命令,而不是监听HTTP请求。关机端口被定义为server.xml元素中的属性(我相信)。默认安装监听端口8005。但是,如果删除了该属性,则服务器将不会打开该端口,并且关闭操作必须以不同的方式进行(或完全没有进行)。