11
votes

When i Start tomcat on eclipse i got this message:

Port 8009 required by Tomcat v6.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

when i start tomcat manually it gives me this exceptions track:

C:\apache-tomcat-6\bin>catalina.bat run
Using CATALINA_BASE:   "C:\apache-tomcat-6"
Using CATALINA_HOME:   "C:\apache-tomcat-6"
Using CATALINA_TMPDIR: "C:\apache-tomcat-6\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.6.0_20"
Using CLASSPATH:       "C:\apache-tomcat-6\bin\bootstrap.jar"
Dec 14, 2011 11:32:17 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.22.
Dec 14, 2011 11:32:17 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], r
andom [true].
Dec 14, 2011 11:32:20 AM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 14, 2011 11:32:20 AM org.apache.coyote.ajp.AjpAprProtocol init
SEVERE: Error initializing endpoint
java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket
address (protocol/network address/port) is normally permitted.
        at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:649)
        at org.apache.coyote.ajp.AjpAprProtocol.init(AjpAprProtocol.java:160)
        at org.apache.catalina.connector.Connector.initialize(Connector.java:104
9)
        at org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:703)
        at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:838)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Dec 14, 2011 11:32:20 AM org.apache.catalina.core.StandardService initialize
SEVERE: Failed to initialize connector [Connector[AJP/1.3-8009]]
LifecycleException:  Protocol handler initialization failed: java.lang.Exception
: Socket bind failed: [730048] Only one usage of each socket address (protocol/n
etwork address/port) is normally permitted.
        at org.apache.catalina.connector.Connector.initialize(Connector.java:105
1)
        at org.apache.catalina.core.StandardService.initialize(StandardService.j
ava:703)
        at org.apache.catalina.core.StandardServer.initialize(StandardServer.jav
a:838)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:538)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:562)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Dec 14, 2011 11:32:20 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 5684 ms
Dec 14, 2011 11:32:21 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Dec 14, 2011 11:32:21 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
Dec 14, 2011 11:32:21 AM org.apache.catalina.startup.HostConfig deployDescriptor

INFO: Deploying configuration descriptor host-manager.xml
Dec 14, 2011 11:32:23 AM org.apache.catalina.startup.HostConfig deployDescriptor

INFO: Deploying configuration descriptor manager.xml
Dec 14, 2011 11:32:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Dec 14, 2011 11:32:23 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Dec 14, 2011 11:32:24 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Dec 14, 2011 11:32:24 AM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Dec 14, 2011 11:32:24 AM org.apache.coyote.ajp.AjpAprProtocol start
SEVERE: Error starting endpoint
java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket
address (protocol/network address/port) is normally permitted.
        at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:649)
        at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:766)
        at org.apache.coyote.ajp.AjpAprProtocol.start(AjpAprProtocol.java:188)
        at org.apache.catalina.connector.Connector.start(Connector.java:1122)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
40)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Dec 14, 2011 11:32:24 AM org.apache.catalina.core.StandardService start
SEVERE: Failed to start connector [Connector[AJP/1.3-8009]]
LifecycleException:  service.getName(): "Catalina";  Protocol handler start fail
ed: java.lang.Exception: Socket bind failed: [730048] Only one usage of each soc
ket address (protocol/network address/port) is normally permitted.
        at org.apache.catalina.connector.Connector.start(Connector.java:1129)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
40)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Dec 14, 2011 11:32:24 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3966 ms
Dec 14, 2011 11:33:25 AM org.apache.coyote.http11.Http11AprProtocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Dec 14, 2011 11:33:25 AM org.apache.coyote.ajp.AjpAprProtocol pause
INFO: Pausing Coyote AJP/1.3 on ajp-8009
Dec 14, 2011 11:33:26 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
Dec 14, 2011 11:33:26 AM org.apache.coyote.http11.Http11AprProtocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
Dec 14, 2011 11:33:26 AM org.apache.coyote.ajp.AjpAprProtocol destroy
INFO: Stopping Coyote AJP/1.3 on ajp-8009
Terminate batch job (Y/N)? y

C:\apache-tomcat-6\bin>

How can fix it? Another tomcat is not running, i checked with localhost:8080. Thanks in advance

6

6 Answers

14
votes

Check with netstat -ntlp | grep :8009 to see what process is using 8009 already.

9
votes

Kill the process first. Then check your %TOMCAT_HOME%/conf/server.xml file. You should replace port="8009" with port="8010".

4
votes

double check by running ps -ef | grep tomcat to kill -9 the process or from your task manager if there is any java process running to terminate it. Most likely your previous tomcat startup session wasn't ended normally.

3
votes

For Ubuntu/Linux

Step 1: Find the process id that is using the port 8009

netstat -lnp | grep 8009
or
ps -aef | grep tomcat

Step 2: Kill the process using process id in above result

kill -9 process_id

For Windows

Step 1: Find the process id

netstat -ano | findstr 8009

Step 2: Open command prompt as administrator and kill the process

taskkill /F /pid process_id_from_step_1

Changing Port Number

In you wan to run two Apache tomcat in parallel then change the conflicting port number in Eclipse server overview.

  1. Open Eclipse

  2. Go to Servers panel

Eclipse Servers Panel

  1. Double click the configured server name to open Overview window

  2. Open the Portstab. You will get the following:

    • Tomcat adminport

    • HTTP/1.1

    • AJP/1.3

Eclipse Tomcat Server Overview

  1. Change conflicting port number of AJP/1.3 (e.g. to 9009)

  2. You might have to also change the port of Tomcat admin port (e.g. to 9005) and of HTTP/1.1 (e.g. to 9090).

  3. Save it (ctrl+s) and start your server.

0
votes

Your port 8009 is already in use. It can be another tomcat or something different.
You should manually kill any tomcat process.
EDIT: assuming you are on Windows platform, kill all javaw.exe process using CTRL-ALT-Suppr

-1
votes

check the file server.xml in folder \apache-tomcat-6.0.32\conf the port address will be mentioned, if it is 8080, try changing it to 8081 and start the server and call localhost:8081

in server.xml it will be like below:

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />