Tomcat6关闭失败
我安装了 tomcat 6.0.32 并在其上运行我的 Web 应用程序。当 tomcat 正确启动或停止时,通常的停止/启动工作正常。但是当我尝试在启动过程中停止tomcat时,停止失败。
$service tomcat6 stop
Stopping tomcat6: [FAILED]
日志中的错误是:
SEVERE: Catalina.stop:
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:422)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:338)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:416)
我也尝试过使用强制,但不起作用。有谁知道我们该如何解决这个问题?
注意:我能够在启动过程中停止tomcat6(6.0.24),但它在6.0.32版本中不起作用。任何帮助/信息都会有很大帮助!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是为了帮助遇到同样问题的人。请记住,我无法解释更改的工作原理,但它解决了我的问题,因此将其发布给其他人。
/etc/init.d/tomcat6
中有一个名为“parseOption”的函数,它解析配置文件中指定的配置。该函数在其他函数 [stop/start] 中被调用,并且在解析配置方面运行良好,如上面的输出所示。在 stop 函数内部,它最初的调用方式如下:
我将上面的内容更改为:
并且它起作用了。我能够在启动过程中或其他情况下停止tomcat。
停止功能的其余部分也正确执行[删除pid文件,终止进程...]。
当 tomcat 处于启动模式或启动时,实现有何不同尚不清楚,因为在启动模式下,常规停止可以正常工作,无需任何更改。
This is to help anyone who encounters the same problem. Please bear in mind that I have no explanation of how the change works, but it solved my problem so posting it for others.
There is a function called "parseOption" in
/etc/init.d/tomcat6
, which parses the configurations specified in the config file. This function is being called in the other functions [stop/start], and does work fine in parsing the configs as shown in the output above.Inside the stop function, it is originally called as follows:
I changed the above to:
and it worked. I was able to stop tomcat in the middle of a start up and otherwise.
The rest of the stop function is executed properly as well [removing the pid file, killing the process...].
How different the implementation is when the tomcat is in started mode or starting up, is unclear, since regular stop works fine without any changes, in the started mode.