Saturday, May 12, 2007

java.net.BindException: Address already in use:8080

After several times to reload the deployed application in tomcat on Mac OSX. I found the tomcat fail to start with this exception messages.

2007/5/12 下午 01:17:44 org.apache.coyote.http11.Http11BaseProtocol start
嚴重的: Error starting endpoint
java.net.BindException: Address already in use:8080
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:312)
at org.apache.coyote.http11.Http11BaseProtocol.start(Http11BaseProtocol.java:150)
at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:75)
at org.apache.catalina.connector.Connector.start(Connector.java:1089)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2007/5/12 下午 01:17:44 org.apache.catalina.startup.Catalina start
嚴重的: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.net.BindException: Address already in use:8080
at org.apache.catalina.connector.Connector.start(Connector.java:1096)
at org.apache.catalina.core.StandardService.start(StandardService.java:459)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2007/5/12 下午 01:17:44 org.apache.catalina.startup.Catalina start

It's obviously that there has another process occupied the port 8080 or 8009. I uses the command, "lsof -i | grep LISTEN" to check the PID of the process that using the port.

imachome:/usr/local/apache-tomcat-5.5.20/logs chanapps$ lsof -i | grep LISTEN
java 298 chanapps 11u IPv6 0x2e2e3a0 0t0 TCP *:http-alt (LISTEN)
java 298
chanapps 18u IPv6 0x2e2ec50 0t0 TCP *:8009 (LISTEN)

And then, kill the process with "kill -9 298" command. Now, the tomcat recover!

No comments:

XML Master Cert Group

Google Groups
XML Master Certification
Visit this group