Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEVERE: Could not contact localhost:8005. Tomcat may not be running error while shutting down

I am able to start server any number of times but when i am trying to shut it down it is showing error as below. Can anyone please tell me how to resolve.

localhost:8080 is displaying message as successfully installed. Congratulations!

Using CATALINA_BASE:   /usr/share/apache-tomcat-8.0.33

Using CATALINA_HOME:   /usr/share/apache-tomcat-8.0.33

Using CATALINA_TMPDIR: /usr/share/apache-tomcat-8.0.33/temp

Using JRE_HOME:        /

Using CLASSPATH:       /usr/share/apache-tomcat-8.0.33/bin/bootstrap.jar:/usr/share/apache-tomcat-8.0.33/bin/tomcat-juli.jar

org.apache.catalina.startup.Catalina stopServer

SEVERE: Could not contact localhost:8005. Tomcat may not be running.

SEVERE: Catalina.stop: 

java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

at java.net.Socket.<init>(Socket.java:434)

at java.net.Socket.<init>(Socket.java:211)

at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:450)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:400)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:487)


**Log file**

12-Apr-2016 12:01:16.731 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_71-b15

12-Apr-2016 12:01:16.731 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation

12-Apr-2016 12:01:16.731 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /usr/share/apache-tomcat-8.0.33

12-Apr-2016 12:01:16.733 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /usr/share/apache-tomcat-8.0.33

12-Apr-2016 12:01:16.733 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/usr/share/apache-tomcat-8.0.33/conf/logging.properties

12-Apr-2016 12:01:16.733 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

12-Apr-2016 12:01:16.733 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=/usr/share/apache-tomcat-8.0.33/endorsed

12-Apr-2016 12:01:16.734 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/usr/share/apache-tomcat-8.0.33

12-Apr-2016 12:01:16.734 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/usr/share/apache-tomcat-8.0.33

12-Apr-2016 12:01:16.734 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/usr/share/apache-tomcat-8.0.33/temp

12-Apr-2016 12:01:16.734 INFO [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

12-Apr-2016 12:01:17.280 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]

12-Apr-2016 12:01:17.363 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read

12-Apr-2016 12:01:17.367 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]

12-Apr-2016 12:01:17.372 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read

12-Apr-2016 12:01:17.373 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 2123 ms

12-Apr-2016 12:01:17.444 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina

12-Apr-2016 12:01:17.445 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.33

12-Apr-2016 12:01:17.511 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/share/apache-tomcat-8.0.33/webapps/ROOT

12-Apr-2016 12:01:18.243 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/share/apache-tomcat-8.0.33/webapps/ROOT has finished in 720 ms

12-Apr-2016 12:01:18.244 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/share/apache-tomcat-8.0.33/webapps/docs

12-Apr-2016 12:01:18.352 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/share/apache-tomcat-8.0.33/webapps/docs has finished in 108 ms

12-Apr-2016 12:01:18.354 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/share/apache-tomcat-8.0.33/webapps/examples

12-Apr-2016 12:01:18.995 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/share/apache-tomcat-8.0.33/webapps/examples has finished in 641 ms

12-Apr-2016 12:01:18.996 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/share/apache-tomcat-8.0.33/webapps/host-manager

12-Apr-2016 12:01:19.065 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/share/apache-tomcat-8.0.33/webapps/host-manager has finished in 69 ms

12-Apr-2016 12:01:19.066 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /usr/share/apache-tomcat-8.0.33/webapps/manager

12-Apr-2016 12:01:19.123 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /usr/share/apache-tomcat-8.0.33/webapps/manager has finished in 57 ms

12-Apr-2016 12:01:19.137 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]

12-Apr-2016 12:01:19.144 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]

12-Apr-2016 12:01:19.145 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 1772 ms

12-Apr-2016 12:03:46.070 INFO [main] org.apache.catalina.core.StandardServer.await A valid shutdown command was received via the shutdown port. Stopping the Server instance.

12-Apr-2016 12:03:46.071 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8080"]

12-Apr-2016 12:03:46.124 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]

12-Apr-2016 12:03:46.175 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina

12-Apr-2016 12:03:46.272 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]

12-Apr-2016 12:03:46.288 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]

12-Apr-2016 12:03:46.382 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]

12-Apr-2016 12:03:46.393 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]

12-Apr-2016 12:30:40.202 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.33

12-Apr-2016 12:30:40.206 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 18 2016 20:31:49 UTC

12-Apr-2016 12:30:40.207 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.33.0

12-Apr-2016 12:30:40.207 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Linux

12-Apr-2016 12:30:40.207 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            3.10.0-327.10.1.el7.x86_64

12-Apr-2016 12:30:40.207 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64

12-Apr-2016 12:30:40.208 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.71-2.b15.el7_2.x86_64/jre
like image 283
Laxmi Avatar asked Apr 12 '16 07:04

Laxmi


2 Answers

I just answered this question under another question.

I solved it today,it maybe a bug with jdk-1.8.x.

For example,my jdk path is "/usr/java/jdk1.8.0_144".

cd /usr/java/jdk1.8.0_144/jre/lib/security/

find the file which named "java.security",

vi java.security

find "securerandom.source=file:/dev/random".

Modify "securerandom.source=file:/dev/./urandom ".

Then,go to the Tomcat/bin directory, execute ./start.sh and ./shutdown.sh,find that everything is all right.

like image 172
xiaoyangLee Avatar answered Oct 22 '22 07:10

xiaoyangLee


Please make sure that the server port not changed after the server started!

Changing the sever port of a running server could make it unable to shutdown with error message like the following:

06-Feb-2018 10:17:10.682 SEVERE [main] org.apache.catalina.startup.Catalina.stopServer Could not contact [localhost:[8005]]. Tomcat may not be running. 06-Feb-2018 10:17:10.693 SEVERE [main] org.apache.catalina.startup.Catalina.stopServer Catalina.stop: java.net.ConnectException: Connection refused: connect

like image 3
Summer Avatar answered Oct 22 '22 09:10

Summer