Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat not starting (throwing java.net.BindException: )

Tags:

I have done the following settings to run a Java web project but somehow my Tomcat is not starting from 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   

Then as is required, I set up a new server from Eclipse and give the Tomcat installation path.

As advised in some forums, I have added tomcat-juli.jar to the class path.
In spite of all this when I try starting the Tomcat Server, I get the the error as tomcat not staring in 45 sec.

I get the following log message:

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 

I have referred multiple forums but am badly stuck with the situation. Please guide me.

like image 702
user1649415 Avatar asked Sep 18 '12 16:09

user1649415


1 Answers

these lines :

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

imply that there is already a service running on port 8009. is there a tomcat (with ajp) running already?

if the service running on 8009 is needed you could change the connector configuration in server.xml to something like below :

<Connector port="8089" protocol="AJP/1.3" redirectPort="8443" /> 
like image 187
olly_uk Avatar answered Nov 02 '22 23:11

olly_uk