Linux系统下启动Tomcat有时报Address already in use<null...的问题
我知道是端口被占用,可是第壹次启动就是成功的,再关闭后,重启就报错,具体错误码信息如下:
01
2010-10-24 18:12:23 org.apache.catalina.core.AprLifecycleListener init
02
Message: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/local/jdk1.5.0_06/jre/lib/i386/server:/usr/local/jdk1.5.0_06/jre/lib/i386:/usr/local/jdk1.5.0_06/jre/../lib/i386:/opt/sybase/OCS-12_5/lib:/opt/sybase/OCS-12_5/lib3p:/opt/sybase/SQLRemote/lib:/opt/sybase/ASE-12_5/lib:/opt/sybase/OCS-12_5/lib:/opt/sybase/OCS-12_5/lib3p:/opt/sybase/SQLRemote/lib:/opt/sybase/ASE-12_5/lib:
03 www.zhishiwu.com
2010-10-24 18:12:23 org.apache.coyote.http11.Http11Protocol init
04
Fatal: Error initializing endpoint
05
java.net.BindException: Address already in use<null>:8080
06
at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:502)
07
at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
08
at org.apache.catalina.connector.Connector.initialize(Connector.java:1058)
09
at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
10
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
11
at org.apache.catalina.startup.Catalina.load(Catalina.java:530)
12
at org.apache.catalina.startup.Catalina.load(Catalina.java:550)
13
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
14
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
15
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16
at java.lang.reflect.Method.invoke(Method.java:585)
17
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
18
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
19
2010-10-24 18:12:23 org.apache.catalina.startup.Catalina load
20
Fatal: Catalina.start
21
LifecycleException: Protocol handler initialization failed: java.net.BindException: Address already in use<null>:8080
22
at org.apache.catalina.connector.Connector.initialize(Connector.java:1060)
23
at org.apache.catalina.core.StandardService.initialize(StandardService.java:677)
24
at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
25
at org.apache.catalina.startup.Catalina.load(Catalina.java:530)
26
at org.apache.catalina.startup.Catalina.load(Catalina.java:550)
27
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
28
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
29
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
30
at java.lang.reflect.Method.invoke(Method.java:585)
31
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:260)
32
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:412)
33 www.zhishiwu.com
2010-10-24 18:12:23 org.apache.catalina.startup.Catalina load
34
Message: Initialization processed in 574 ms
那是因为你的tomcat已经启动了tomcat自带的关闭脚本,有时候关闭看上去成功了,其实并没有关闭。可以使用如下命令查看进程列表:
1
ps -ef | grep java
如果java进程还在,就用如下命令把它们全部手动关闭掉,再启动tomcat就可以解决了。
1
kill -9 pid
其中PID要替换成进程号才行,另外,使用命令ps -ef|grep java可以同时看到五六个进程,需要逐个把它们关闭,然后再重新启动tomcat就不会报上面那个错误了。
作者 Bairrfhoinn