我在同一个tomcat上运行了2个Spring Boot项目:
目的
详细信息
考虑到BS的目的,其写为while(1)
。
Tomcat错误
第一次尝试:
Using CATALINA_PID: /home/user/bin/pid/tomcat_pid
Tomcat did not stop in time.
PID file was not removed.
To aid diagnostics a thread dump has been written to standard out
第二次尝试:
java.net.ConnectException: Connection refused (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:492) 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.stopServer(Bootstrap.java:406) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495) The stop command failed. Attempting to signal the process to stop through OS signal. Tomcat stopped.
问题:
1.当我重新启动tomcat时,BS项目将仅在运行并且REST-API无法启动(我猜这是由于while(1)
它开始执行而没有提供启动REST-API项目的机会)
2.在停止tomcat时,它不会一次停止,而是当我们尝试再停止一次时,它就会停止。
答案 0 :(得分:-1)
此异常通常表示没有服务正在侦听您要连接的IP /端口,因此,您正在尝试连接到错误的IP /端口,或者服务器未启动。