我正在尝试在我的 Raspberry Pi 3 B+(运行 Raspbian)上运行 Tomcat 9,但在尝试启动时出现此错误:
30-Jan-2019 17:27:53.934 SEVERE [main] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component [Connector[HTTP/1.1-8080]]
注意:Raspbian 是 Debian 操作系统。
答案1
正如日志所述:
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:236)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1085)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1098)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:557)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:74)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:976)
... 13 more
还:
Failed to create server shutdown socket on address [localhost] and port [8005] (base port [8005] and offset [0])
这意味着某些端口被另一个进程占用(8080、8005、8009)
您可以通过以下方式测试:
telnet localhost 8080
您可以通过以下方式了解哪个进程占用了哪个端口:
netstat -tulpn