我创建了tomcat集群,当我尝试启动tomcat时,它显示tomcat已启动但我无法从localhost访问:当我尝试关闭它时,我也无法关闭它。 请帮我解决这个问题。
gaiz@ubuntu:~/softz/cluster$ ./startup-instance1.sh
Using CATALINA_BASE: /home/gaiz/softz/cluster/instance-1
Using CATALINA_HOME: /home/gaiz/softz/cluster/apache-tomcat-7.0.55
Using CATALINA_TMPDIR: /home/gaiz/softz/cluster/instance-1/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/bootstrap.jar:/home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/tomcat-juli.jar
Tomcat started.
当我尝试关闭它时会发生此错误
gaiz@ubuntu:~/softz/cluster$ ./shutdown-instance1.sh
Using CATALINA_BASE: /home/gaiz/softz/cluster/instance-1
Using CATALINA_HOME: /home/gaiz/softz/cluster/apache-tomcat-7.0.55
Using CATALINA_TMPDIR: /home/gaiz/softz/cluster/instance-1/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/bootstrap.jar:/home/gaiz/softz/cluster/apache-tomcat-7.0.55/bin/tomcat-juli.jar
Sep 12, 2014 9:13:42 AM org.apache.catalina.startup.Catalina stopServer
SEVERE: Could not contact localhost:8006. Tomcat may not be running.
Sep 12, 2014 9:13:42 AM 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.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.<init>(Socket.java:425)
at java.net.Socket.<init>(Socket.java:208)
at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)
答案 0 :(得分:1)
很有可能Tomcat正在启动并失败,但不是立即启动。因此,您的启动脚本认为它正在运行,但是当您尝试停止服务时,它无法说它无法停止Tomcat,因为它没有运行。启动Tomcat后,您可以运行ps aux | grep catalina
并查看该进程是否仍在运行。
假设它失败了,请在Tomcat日志中查找错误。这可能是/home/gaiz/softz/cluster/instance-1/logs
。检查所有日志,包括catalina.yyyy-mm-dd.log
,catalina.out
和localhost.yyyy-mm-dd.log
,因为错误会被隔离到其中一个日志文件中。同时检查任何特定于应用程序的日志,因为您也可能遇到应用程序问题。