2013-06-09 12:03:26

LifecycleException: Protocol Handler Initialization Failed: java.net.BindException: Address Already in Use:8080

 

Problem:

Invisible programm listening on port 8080

System: Ubuntu 9.10 / Grails 1.2.1 / Java 6

When: while starting a grails application, the following error occured: Error Message

LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use<null>:8080
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:135)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:287)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
at _GrailsRun_groovy.runInline(_GrailsRun_groovy:115)
at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Server failed to start: LifecycleException:  Protocol handler initialization failed: java.net.BindException: Address already in use<null>:8080

$ netstat -tupl

(Es konnten nicht alle Prozesse identifiziert werden; Informationen über
nicht-eigene Processe werden nicht angezeigt; Root kann sie anzeigen.)
Aktive Internetverbindungen (Nur Server)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:7634          *:*                     LISTEN      -              
tcp        0      0 *:ssh                   *:*                     LISTEN      -              
tcp        0      0 localhost:ipp           *:*                     LISTEN      -              
tcp        0      0 localhost:mysql         *:*                     LISTEN      -              
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      -              
tcp6       0      0 localhost:ipp           [::]:*                  LISTEN      -              
tcp6       0      0 [::]:http-alt           [::]:*                  LISTEN      -              

Analysis

Executing netstat as normal user hides the programm which is using port 8080 (in this case, an unexpected tomcat instance).

Solution

  1. shutdown tomcat6 running on port 8080

    sudo /etc/init.d/tomcat6 stop

  2. use netstat as root

    sudo netstat -tupl tcp6 0 0 [::]:http-alt [::]:* LISTEN 1972/jsvc

[originally posted in 2010]