Tomcat6关闭失败

发布于 2024-11-16 15:30:43 字数 1481 浏览 3 评论 0 原文

我安装了 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版本中不起作用。任何帮助/信息都会有很大帮助!

I have tomcat 6.0.32 installed and running my web application on it. Usual stop/start works fine, when the tomcat is properly started or stopped. But when I try to stop the tomcat when it is in the middle of a startup, the stop fails.

$service tomcat6 stop

Stopping tomcat6:                                          [FAILED]

The error in the log is:

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)

I have tried using force as well, but it doesn't work. Does anyone know how can we fix this?

Note: I was able to stop tomcat6 (6.0.24) in the middle of the startup, but it is not working in 6.0.32 version. Any help/info would be a great help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

农村范ル 2024-11-23 15:30:43

这是为了帮助遇到同样问题的人。请记住,我无法解释更改的工作原理,但它解决了我的问题,因此将其发布给其他人。

/etc/init.d/tomcat6中有一个名为“parseOption”的函数,它解析配置文件中指定的配置。该函数在其他函数 [stop/start] 中被调用,并且在解析配置方面运行良好,如上面的输出所示。

在 stop 函数内部,它最初的调用方式如下:

   if [ -f "/var/lock/subsys/${NAME}" ]; then
      parseOptions
      $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1

我将上面的内容更改为:

 if [ -f "/var/lock/subsys/${NAME}" ]; then
    $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1
    parseOptions

并且它起作用了。我能够在启动过程中或其他情况下停止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:

   if [ -f "/var/lock/subsys/${NAME}" ]; then
      parseOptions
      $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1

I changed the above to:

 if [ -f "/var/lock/subsys/${NAME}" ]; then
    $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> $TOMCAT_LOG 2>&1
    parseOptions

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文