Could not contact localhost:8005. Tomcat may not be running error while shutdown tomcat

Could not contact localhost:8005. Tomcat may not be running error while shutdown tomcat



Hi I am trying to shutdown and startup tomcat server. But i am getting below error while running shutdown.sh. Please check below error and suggest me to complete.



Error:


Using CATALINA_BASE: /opt/tomcat8
Using CATALINA_HOME: /opt/tomcat8
Using CATALINA_TMPDIR: /opt/tomcat8/temp
Using JRE_HOME: /usr/java/jdk1.8.0_74
Using CLASSPATH: /opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-ju li.jar
Jul 24, 2017 11:01:47 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8005. Tomcat may not be running.
Jul 24, 2017 11:01:48 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.ja va:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocket Impl.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)



Also please find log:


24-Jul-2017 23:48:28.884 SEVERE [main] org.apache.catalina.core.StandardServer.await StandardServer.await: create[localhost:8005]:
java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:420)
at org.apache.catalina.startup.Catalina.await(Catalina.java:717)
at org.apache.catalina.startup.Catalina.start(Catalina.java:663)
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:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)

24-Jul-2017 23:48:28.884 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.884 INFO [main] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
24-Jul-2017 23:48:28.884 INFO [main] org.apache.catalina.core.StandardService.stopInternal Stopping service Catalina
24-Jul-2017 23:48:28.988 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.990 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8082"]
24-Jul-2017 23:48:28.992 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
24-Jul-2017 23:48:28.992 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]






You can't have both these conditions at the same time. Probably the bind error happened first, so Tomcat shut itself down. In any case, if you got 'connection refused', it isn't running. So there is nothing to shut down. So you don't have a problem.

– user207421
Jul 25 '17 at 8:14







172.22.68.60:8080 getting below error in browser This page can’t be displayed •Make sure the web address nap11rh6as510:8006 is correct. •Look for the page with your search engine. •Refresh the page in a few minutes.

– Santhoshkumar
Jul 25 '17 at 8:47






This page can’t be displayed •Make sure the web address 172.22.68.60:8082 is correct. •Look for the page with your search engine. •Refresh the page in a few minutes.

– Santhoshkumar
Jul 25 '17 at 8:48




5 Answers
5



There is some Application running on port 8005 due to which tomcat is not able to bind network on the port. Your shutdown.sh will throw exception because server is not started yet (as there was an issue in starting the server)


netstat -tulnp | grep 8005






Thank you for the response, I tried by changing 8005 to 8006 in server.xml. But the same error occur with 8006.

– Santhoshkumar
Jul 25 '17 at 7:34






Also I am getting below output for "netstat -tulnp | grep 8005" (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 15268/java

– Santhoshkumar
Jul 25 '17 at 7:35






this means that your tomcat is running and is bound to 127.0.0.1:8005. Changing the ports again and again wont help. Your process id is 15268 in the above case. use the command kill -9 15268 to force terminate tomcat and restart using /TOMCAT_HOME/bin/catalina.sh start. Cheers.

– Chitral Verma
Jul 26 '17 at 6:48


kill -9 15268


/TOMCAT_HOME/bin/catalina.sh start






Solution 1(Recommended): Change the port from 8005 to 8006 in /opt/tomcat8/conf/server.xml - Worked for me.Thanks Harneet.

– Shrikant Wandhare
Mar 13 at 7:27



if the timestamps are correct, it suggests that your tomcat startup failed around 23:00 and you tried to shutdown a non existing tomcat service at 11:00 hours






Server time difference in log

– Santhoshkumar
Jul 25 '17 at 7:37



You can try to add
export JRE_HOME=$JAVA_HOME/jre
in /etc/profile,then run
source /etc/profile
it is avalible for me.



http://blog.51cto.com/zero01/2053974. I meet the same problem today. When i want to execute shudown.sh, the log shows that tomcat may not be running, and the connection to port 8005 is refused. When i use netstat -atunp , i find there is no process listening port 8005. So tomcat should fail to start. I search,and find the answer in the link showed below. The key is to change this file



$JAVA_HOME/jre/lib/security/java.security



the data to change is to add char 'u' before 'random'



securerandom.source=file:/dev/random



securerandom.source=file:/dev/urandom



and it works. But i have no idea why?. could someone tell me ? And hope this help others.



try to start from ./catalina.sh run
is every thing is ok then it will come on screen
or it will show some error
like in my case


[root@localhost bin]# ./catalina.sh run
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
Invalid maximum heap size: -Xmx512MB
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.



change memory heap size then it will definately work


[root@localhost bin]# ./catalina.sh run
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar
10-Oct-2017 02:28:13.782 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.23
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 28 2017 10:30:11 UTC
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.23.0
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
10-Oct-2017 02:28:13.808 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.10.0-123.el7.x86_64
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: /root/Desktop/jdk1.8.0_144/jre
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_144-b01
10-Oct-2017 02:28:13.809 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.810 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/root/Desktop/tomcat/apache-tomcat-8.5.23/conf/logging.properties
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.811 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/root/Desktop/tomcat/apache-tomcat-8.5.23
10-Oct-2017 02:28:13.812 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/root/Desktop/tomcat/apache-tomcat-8.5.23/temp
10-Oct-2017 02:28:13.812 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]
10-Oct-2017 02:28:15.306 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:28:15.518 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Oct-2017 02:28:15.551 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:28:15.558 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
10-Oct-2017 02:28:15.568 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 4756 ms
10-Oct-2017 02:28:15.869 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
10-Oct-2017 02:28:15.870 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.23
10-Oct-2017 02:28:16.072 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/ROOT]
10-Oct-2017 02:28:18.435 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/ROOT] has finished in [2,362] ms
10-Oct-2017 02:28:18.436 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/docs]
10-Oct-2017 02:28:18.540 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/docs] has finished in [89] ms
10-Oct-2017 02:28:18.541 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/examples]
10-Oct-2017 02:28:20.151 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/examples] has finished in [1,611] ms
10-Oct-2017 02:28:20.152 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/host-manager]
10-Oct-2017 02:28:20.320 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/host-manager] has finished in [168] ms
10-Oct-2017 02:28:20.321 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/manager]
10-Oct-2017 02:28:20.438 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/root/Desktop/tomcat/apache-tomcat-8.5.23/webapps/manager] has finished in [117] ms
10-Oct-2017 02:28:20.461 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:28:20.540 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:28:20.547 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 4978 ms



^C10-Oct-2017 02:29:29.604 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:29.695 INFO [Thread-5] org.apache.coyote.AbstractProtocol.pause Pausing ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:29:29.748 INFO [Thread-5] org.apache.catalina.core.StandardService.stopInternal Stopping service [Catalina]
10-Oct-2017 02:29:30.063 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:30.069 INFO [Thread-5] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
10-Oct-2017 02:29:30.077 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8081"]
10-Oct-2017 02:29:30.094 INFO [Thread-5] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
[root@localhost bin]# ./startup.sh
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar



Tomcat started.
then again try to shutdown


from /bin# ./shutdown
[root@localhost bin]# ./shutdown.sh
Using CATALINA_BASE: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_HOME: /root/Desktop/tomcat/apache-tomcat-8.5.23
Using CATALINA_TMPDIR: /root/Desktop/tomcat/apache-tomcat-8.5.23/temp
Using JRE_HOME: /root/Desktop/jdk1.8.0_144/jre
Using CLASSPATH: /root/Desktop/tomcat/apache-tomcat-8.5.23/bin/bootstrap.jar:/root/Desktop/tomcat/apache-tomcat-8.5.23/bin/tomcat-juli.jar



good luck






This didn't work for me.

– stktrc
Oct 10 '17 at 6:57



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?