apache tomcat 8009端口正在使用中

时间:2011-12-14 17:42:00

标签: java windows tomcat

当我在eclipse上启动tomcat时,我收到了这条消息:

Tomcat v6.0 Server在localhost上所需的端口8009已在使用中。服务器可能已在另一个进程中运行,或者系统进程可能正在使用该端口。要启动此服务器,您需要停止其他进程或更改端口号。

当我手动启动tomcat时,它给了我这个异常轨道:

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>

如何解决?另一个tomcat没有运行,我检查了localhost:8080。提前致谢

6 个答案:

答案 0 :(得分:13)

请与netstat -ntlp | grep :8009核对,了解正在使用8009的流程。

答案 1 :(得分:9)

首先杀死这个过程。然后检查%TOMCAT_HOME%/ conf / server.xml文件。您应该将 port =“8009”替换为 port =“8010”

答案 2 :(得分:4)

通过运行ps -ef | grep tomcatkill -9进程进行仔细检查,或者从任务管理器运行,如果有任何java进程正在运行以终止它。很可能你之前的tomcat启动会话没有正常结束。

答案 3 :(得分:3)

适用于Ubuntu / Linux

步骤1:查找使用端口8009的进程ID

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

步骤2:使用上述结果

中的进程ID终止进程
kill -9 process_id

适用于Windows

第1步:找到流程ID

netstat -ano | findstr 8009

步骤2:以管理员身份打开命令提示符并终止进程

taskkill /F /pid process_id_from_step_1

更改端口号

您想要并行运行两个Apache tomcat,然后在Eclipse服务器概述中更改冲突的端口号。

  1. 打开Eclipse

  2. 转到Servers panel

  3. Eclipse Servers Panel

    1. 双击配置的服务器名称以打开Overview窗口

    2. 打开Ports标签。您将获得以下内容:

      • Tomcat adminport

      • HTTP/1.1

      • AJP/1.3

    3. Eclipse Tomcat Server Overview

      1. 更改AJP/1.3的冲突端口号(例如更改为9009

      2. 您可能还需要更改Tomcat admin port(例如9005)和HTTP/1.1(例如9090)的端口。

      3. 保存(ctrl + s)并启动服务器。

答案 4 :(得分:0)

您的端口8009已在使用中。它可以是另一个tomcat或其他不同的东西 你应该手动杀死任何tomcat进程 编辑:假设您在Windows平台上,使用CTRL-ALT-Suppr

终止所有javaw.exe进程

答案 5 :(得分:-1)

检查文件夹server.xml中的文件\apache-tomcat-6.0.32\conf 将提及port address,如果是8080,请尝试将其更改为8081并启动服务器并致电localhost:8081

server.xml中的

将如下所示:

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