3

Tomcat suddenly stopped connecting to http://localhost:8080 today. It was working until yesterday, and I didn't change anything. Windows - Windows 7 64 bit. Tomcat - 7.0.59. Can anyone please help.

Following is my 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

"

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>
gagan
  • 173
  • 1
  • 3
  • 11
  • there is no error.. server is up and browser keeps on trying to the server. – gagan Jul 02 '15 at 15:55
  • What's the output of tomcat when you start it ? It should show you on which port it is running and which webapps got deployed – Marged Jul 02 '15 at 15:57
  • 1
    'Cannot connect to http://localhost:8080' is not the same thing as 'cannot shutdown'. Which is it? – user207421 Feb 16 '18 at 23:02

2 Answers2

1

Looks like other app is using that port (it may be another running instance of tomcat or another app in general). Use netstat -anob (as shown to check here) to find the culprit and close it.

Community
  • 1
  • 1
Luiggi Mendoza
  • 85,076
  • 16
  • 154
  • 332
  • there is nothing running on 8080 – gagan Jul 02 '15 at 16:10
  • Then please edit your question and add the content of the log from Tomcat when it starts. Looks like there's a problem there that we aren't seeing. – Luiggi Mendoza Jul 02 '15 at 16:11
  • Looks like there's no problem with your tomcat. Probably, just probably, there's no default app or it was removed (by you or by someone else). Try deploying an app there and see if it works. – Luiggi Mendoza Jul 02 '15 at 16:23
  • I don't remember that I had any default app. It was working yesterday.. I didn't even restart it today.. Can I try some other port? – gagan Jul 02 '15 at 16:29
  • I edited my post, I get a message when I try to shutdown. Can you please see? – gagan Jul 02 '15 at 16:34
  • Probably port 8005 is being used. Don't only check if port 8080 is being used. Check all the ports that Tomcat should use. – Luiggi Mendoza Jul 02 '15 at 16:35
  • how can I kill something running on the port? – gagan Jul 02 '15 at 16:36
  • The command above will provide info of the process using the port. Press Ctrl + Shift + Escape, the Task Manager will appear. Find the culprit process in the Task Manager, in Processes tab. Kill it from there. – Luiggi Mendoza Jul 02 '15 at 16:38
  • I could kill it.. now I am able to start tomcat, but on shutdown, I get the error that Tomcat may be not be running. Looks like it's not starting properly. – gagan Jul 02 '15 at 16:44
  • @gagan Look if tomcat is running in the Windows Task Manager. Look trough all tomcat logs that you can find. – nos Dec 18 '17 at 13:38
0

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.

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).

Erwin Smout
  • 18,113
  • 4
  • 33
  • 52