web-dev-qa-db-ja.com

localhost:8005に接続できませんでした。 Tomcatのシャットダウン中にTomcatがエラーを実行していない可能性があります

こんにちは私はTomcatサーバーをシャットダウンして起動しようとしています。しかし、shutdown.shの実行中にエラーが発生します。以下のエラーを確認して、完了するように提案してください。

エラー:

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)

また、ログを見つけてください:

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"]
4
Santhoshkumar

ポート8005で実行されているアプリケーションがいくつかあります。これは、Tomcatがポート上のネットワークをバインドできないためです。サーバーがまだ起動されていないため、shutdown.shは例外をスローします(サーバーの起動に問題があったため)

  • 解決策1(推奨):/ opt/Tomcat8/conf/server.xmlでポートを8005から8006に変更します
  • 解決策2:netstat -tulnp | grep 8005で8005を使用しているアプリケーションを確認し、オフにしてください。
1
Harneet Singh

タイムスタンプが正しい場合は、Tomcatの起動が23:00頃に失敗し、既存のTomcatサービスを11:00にシャットダウンしようとしたことを示しています。

1
Irwan Hendra

http://blog.51cto.com/zero01/2053974 。今日も同じ問題に直面しています。 shudown.shを実行したい場合、ログにはTomcatが実行されていない可能性があり、ポート8005への接続が拒否されていることが示されます。 netstat -atunpを使用すると、ポート8005をリッスンしているプロセスがないことがわかります。したがって、Tomcatは起動に失敗するはずです。私は検索し、以下に示すリンクで答えを見つけます。重要なのは、このファイルを変更することです

$ Java_HOME/jre/lib/security/Java.security

変更するデータは、「ランダム」の前に文字「u」を追加することです。

securerandom.source = file:/ dev/random

securerandom.source = file:/ dev/urandom

そしてそれは動作します。しかし、なぜかわかりません。誰か教えてもらえますか?そして、これが他の人を助けることを願っています。

1
冯金禄

/ etc/profileにexportJRE_HOME = $ Java_HOME/jreを追加してから、ソース/ etc/profileを実行してください。

1
user10370787

./catalina.shから始めてみてください。実行はすべて問題ありません。画面に表示されるか、私の場合のようにエラーが表示されます。

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

メモリヒープサイズを変更すると、間違いなく機能します

[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が起動しました。その後、もう一度シャットダウンしてみてください

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

幸運を

0
Nafish shahzad