一尘不染

Tomcat无法启动(抛出java.net.BindException:)

tomcat

我已经进行了以下设置来运行一个Java Web项目,但是以某种方式我的Tomcat不是从Eclipse启动的:

JAVA_HOME : C:\Program Files\Java\jdk1.6.0_03  
PATH : C:\Program Files\Java\jdk1.6.0_03\bin  
CATALINA_HOME : D:\javaworkspaces\apache-tomcat-7.0.27

然后根据需要,我从Eclipse设置了一个新服务器,并提供了Tomcat的安装路径。

正如在某些论坛中建议的那样,我已经添加tomcat-juli.jar了类路径。
尽管所有这些,当我尝试启动Tomcat Server时,都会出现错误,因为tomcat在45秒内没有启动。

我收到以下日志消息:

Jul 26, 2012 5:49:34 PM org.apache.catalina.core.AprLifecycleListener init  
INFO: The APR based Apache Tomcat Native library which allows optimal performance in     production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_03\bin;D:\eclipse-jee-indigo-SR2-win32\eclipse;;.  
Jul 26, 2012 5:49:34 PM org.apache.tomcat.util.digester.SetPropertiesRule   
 begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property         'source' to 'org.eclipse.jst.j2ee.server:JEE_Day01' did not find a matching property.  
Jul 26, 2012 5:49:34 PM org.apache.coyote.AbstractProtocol init  
INFO: Initializing ProtocolHandler ["http-bio-80"]  
Jul 26, 2012 5:49:35 PM org.apache.coyote.AbstractProtocol init  
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]  
Jul 26, 2012 5:49:35 PM org.apache.coyote.AbstractProtocol init  
SEVERE: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-8009"]  
java.net.BindException: Address already in use: JVM_Bind <null>:8009  
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:393)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:566)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:417)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:956)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:624)
at org.apache.catalina.startup.Catalina.load(Catalina.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)  
Caused by: java.net.BindException: Address already in use: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49)
at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:380)
... 16 more  
Jul 26, 2012 5:49:35 PM org.apache.catalina.core.StandardService initInternal    
    SEVERE: Failed to initialize connector [Connector[AJP/1.3-8009]]
org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-8009]]  
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)  
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)  
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
at org.apache.catalina.startup.Catalina.load(Catalina.java:624)
at org.apache.catalina.startup.Catalina.load(Catalina.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:449)  
Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:958)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
... 12 more

我已经推荐了多个论坛,但情况非常糟糕。请指导我。


阅读 329

收藏
2020-06-16

共1个答案

一尘不染

这些行:

SEVERE: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-8009"]
java.net.BindException: Address already in use: JVM_Bind <null>:8009

表示端口8009上已经有服务在运行。tomcat(带有ajp)已经在运行吗?

如果需要在8009上运行的服务,则可以将server.xml中的连接器配置更改为如下所示:

<Connector port="8089" protocol="AJP/1.3" redirectPort="8443" />
2020-06-16