H5W3
当前位置:H5W3 > 其他技术问题 > 正文

tomcat重启后,web页面无法显示!

利用tomcat的startup.sh 与 shutdown.sh 重启tomcat.
重启是因为要在webapps放入新的文件.
步骤是:
先shutdown, 后放入webapps文件,后startup启动,
第一次startup没有报错

[root@iz2zea0v6yzqrn1lbze76iz ~]# sh tom.sh 1
Using CATALINA_BASE:   /usr/local/tomcat/tomcat907_1
Using CATALINA_HOME:   /usr/local/tomcat/tomcat907_1
Using CATALINA_TMPDIR: /usr/local/tomcat/tomcat907_1/temp
Using JRE_HOME:        /usr/local/java/jdk9
Using CLASSPATH:       /usr/local/tomcat/tomcat907_1/bin/bootstrap.jar:/usr/local/tomcat/tomcat907_1/bin/tomcat-juli.jar
**Tomcat started.**
tom.sh run succeed. 

shutdown了下,也没有报错.

[root@iz2zea0v6yzqrn1lbze76iz ~]# sh tom.sh 0
Using CATALINA_BASE:   /usr/local/tomcat/tomcat907_1
Using CATALINA_HOME:   /usr/local/tomcat/tomcat907_1
Using CATALINA_TMPDIR: /usr/local/tomcat/tomcat907_1/temp
Using JRE_HOME:        /usr/local/java/jdk9
Using CLASSPATH:       /usr/local/tomcat/tomcat907_1/bin/bootstrap.jar:/usr/local/tomcat/tomcat907_1/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
tom.sh run succeed.

但最后问题就来了,之后更改了webapps文件,其后要再启动,
启动是像之前一样没有报错的,但是我继而访问网页
无法访问此网站
www.ykmimi.com 拒绝了我们的连接请求。


其后我想再重启一下,关闭tomcat,遇到bug报错:

[root@iz2zea0v6yzqrn1lbze76iz ~]# sh tom.sh 0
Using CATALINA_BASE:   /usr/local/tomcat/tomcat907_1
Using CATALINA_HOME:   /usr/local/tomcat/tomcat907_1
Using CATALINA_TMPDIR: /usr/local/tomcat/tomcat907_1/temp
Using JRE_HOME:        /usr/local/java/jdk9
Using CLASSPATH:       /usr/local/tomcat/tomcat907_1/bin/bootstrap.jar:/usr/local/tomcat/tomcat907_1/bin/tomcat-juli.jar
NOTE: Picked up JDK_JAVA_OPTIONS:  --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
May 07, 2018 8:03:27 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact [localhost:[8005]]. Tomcat may not be running.
May 07, 2018 8:03:27 PM org.apache.catalina.startup.Catalina stopServer
SEVERE: Catalina.stop: 
java.net.ConnectException: Connection refused (Connection refused)
    at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:400)
    at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:243)
    at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:225)
    at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:402)
    at java.base/java.net.Socket.connect(Socket.java:591)
    at java.base/java.net.Socket.connect(Socket.java:540)
    at java.base/java.net.Socket.<init>(Socket.java:436)
    at java.base/java.net.Socket.<init>(Socket.java:213)
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:403)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)

tom.sh run succeed. 

补充:云服务器重启了,进行上述步骤,问题依旧?

回答:

有这么一行:
SEVERE: Could not contact [localhost:[8005]]. Tomcat may not be running.
tomcat启动没报错但是没有启动起来。
最简单的办法,重启电脑试一下。

回答:

服务器维护最重要是学会看日志输出,你的/usr/local/tomcat/tomcat907_1下可能有个logs的目录,把下面的日志输出都检查一下,你就会找到出错的原因了.

本文地址:H5W3 » tomcat重启后,web页面无法显示!

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址