Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted

This problem occurs when a process (program) is using a port and another process (program) tries to use the same, thus causing conflict. Because that specific port is already in use by a program, another program is prevented from using that same port.

In my case, this problem occurred because of Tomcat & Winstone (Hudson).

Case 1: When Hudson is already running and Tomcat is started:

Jan 13, 2010 2:51:38 PM org.apache.coyote.http11.Http11AprProtocol 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:576)

at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:116)

at org.apache.catalina.connector.Connector.initialize(Connector.java:1017)

at org.apache.catalina.core.StandardService.initialize(StandardService.java:578)

at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:782)

at org.apache.catalina.startup.Catalina.load(Catalina.java:504)

.....

.....

.....

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

Jan 13, 2010 2:51:39 PM org.apache.catalina.startup.Catalina start

INFO: Server startup in 1000 ms

 
Case 2: When Tomcat is already running and Hudson is started:
 
 
In my case, the above exception was encountered because the default HTTP port & AJP port for Tomcat & Winstone were same.

------------------------------------------------------------------------------
--httpPort = The http listening port  (Default is 8080 for Tomcat & Winstone)

--ajp13Port = The ajp13 listening port  (Default is 8009 for Tomcat & Winstone)
------------------------------------------------------------------------------

So to resolve this, just specify a different port number for HTTP & AJP port of Winstone when running Hudson.

E:\>java -jar hudson.war --httpPort=9090 --ajp13Port=9009


In case you’re running Hudson as a service, then go to HUDSON_HOME directory and look for the file hudson.xml. You will find a line similar to the following:
-----------------------------------------------------------------------------------------
-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\hudson.war" --httpPort=8080
-----------------------------------------------------------------------------------------

Make the necessary changes in the HTTP port and add AJP port entry as stated under:
-----------------------------------------------------------------------------------------
-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\hudson.war" --httpPort=9090 --ajp13Port=9095
-----------------------------------------------------------------------------------------
 
[To know about the chemistry between Winstone & Hudson, please visit: http://weblogs.java.net/blog/kohsuke/archive/2007/02/hudson_became_s.html]

In case you want to change Tomcat’s HTTP & AJP port instead of Hudson’s, go to your Tomcat’s conf directory. For me, it was C:\Program Files\apache-tomcat-5.5.27\conf. Look for the file server.xml and change the required ports.

Tip: In this case, you can type http://localhost:portnumber in your browser to see that other program which is causing conflict.

2 comments:

Post a Comment