我的 Mac 上的 tomcat 服务器,终端显示 tomat 已启动,但在浏览器中运行本地主机时,它说未找到网页,但当我尝试关闭 tomcat 时,它抛出了以下错误,当我启动 tomcat 时,我收到消息:\n
$ ./startup.sh
Using CATALINA_BASE: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4
Using CATALINA_HOME: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4
Using CATALINA_TMPDIR: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
Using CLASSPATH: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4/bin/bootstrap.jar:/Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4/bin/tomcat-juli.jar
Tomcat started.
当我关闭 tomcat 时,我得到了这个......
$ ./shutdown.sh
Using CATALINA_BASE: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4
Using CATALINA_HOME: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4
Using CATALINA_TMPDIR: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4/temp
Using JRE_HOME: /Library/Java/JavaVirtualMachines/jdk1.8.0_77.jdk/Contents/Home
Using CLASSPATH: /Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4/bin/bootstrap.jar:/Users/prabu-pt1927/Downloads/apache-tomcat-9.0.4/bin/tomcat-juli.jar
Feb 06, 2018 12:22:51 PM org.apache.catalina.startup.Catalina stopServer SEVERE: Could not contact [localhost:[8005]]. Tomcat may not be running.
Feb 06, 2018 12:22:51 PM 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: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)
当我使用 java - 9.0.4 运行相同的服务器时,它可以正常工作,但是当我使用 java - 1.8 时,它会引发此错误。