Jetty Startup Fails - Address in Use

10,770

Solution 1

You probably need to kill the process. Run ps -ef|grep jetty to get the process number, then kill it. Make sure you kill the process that is running the app server (859 was the process number on my machine).

$ ps -ef|grep jetty
  501   859   852   0 11:42AM ??         0:07.53 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -DSTOP.PORT=0 -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DOPTIONS=jmx -Didea.launcher.port=7532 -Didea.launcher.bin.path=/Applications/IntelliJ IDEA 10.app/bin -Dfile.encoding=MacRoman -classpath start.jar:/Applications/IntelliJ IDEA 10.app/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.eclipse.jetty.start.Main /private/var/folders/sm/y7_k5z7x0cj3qtdyds8x82jr0000gn/T/context4237974524894469000config/contexts-config.xml
  501   861   176   0 11:42AM ttys000    0:00.00 grep jetty
$ kill 859

Solution 2

Check that you don't have jetty-ssl.xml referenced twice.

Solution 3

I had this problem when I provided the start.jar with my own config, but had left the start.ini in the jetty root folder. That made some extra test-stuff be deployed that I hadn't indented. Removing the start.ini file from the Jetty directory solved the problem.

Share:
10,770
David
Author by

David

Updated on June 21, 2022

Comments

  • David
    David about 2 years

    I recently tried jetty on Amazon Ec2; when I try to start; I get 'Address already in use' error.

    I am certain that no other servers are running on the this system.

    I even try changing the ports to something other than 8080 to 8090

    Still the same thing.

    Here is the stacktrace. Any ideas how to solve?

    2011-08-16 17:22:14.722:WARN::FAILED [email protected]:8081 FAILED:       
    java.net.BindException: Address already in use
    
    2011-08-16 17:22:14.722:WARN::FAILED org.eclipse.jetty.server.Server@7dc05ffd:     
        java.net.BindException: Address already in use    
        java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:469)
        at org.eclipse.jetty.start.Main.start(Main.java:612)
        at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:265)
        at org.eclipse.jetty.start.Main.main(Main.java:79)
    
    Caused by: java.net.BindException: Address already in use
    

    Here is the output of netstat

    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
    tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      15507/nginx         
    tcp        0      0 0.0.0.0:4369                0.0.0.0:*                   LISTEN      24836/epmd          
    tcp        0      0 0.0.0.0:28017               0.0.0.0:*                   LISTEN      964/mongod          
    tcp        0      0 0.0.0.0:45204               0.0.0.0:*                   LISTEN      25006/beam          
    tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      847/sshd            
    tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      874/sendmail: accep 
    tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      15507/nginx         
    tcp        0      0 0.0.0.0:27017               0.0.0.0:*                   LISTEN      964/mongod          
    tcp        0      0 127.0.0.1:59795             127.0.0.1:4369              ESTABLISHED 25006/beam          
    tcp        0      0 127.0.0.1:4369              127.0.0.1:59795             ESTABLISHED 24836/epmd          
    tcp        0     48 10.122.219.58:22            69.117.34.101:51887         ESTABLISHED 14431/sshd: ec2-use 
    tcp        0      0 :::80                       :::*                        LISTEN      15507/nginx         
    tcp        0      0 :::22                       :::*                        LISTEN      847/sshd            
    tcp        0      0 :::443                      :::*                        LISTEN      15507/nginx         
    tcp        0      0 :::5672                     :::*                        LISTEN      25006/beam          
    udp        0      0 0.0.0.0:68                  0.0.0.0:*                               740/dhclient        
    udp        0      0 10.122.219.58:123           0.0.0.0:*                               858/ntpd            
    udp        0      0 127.0.0.1:123               0.0.0.0:*                               858/ntpd            
    udp        0      0 0.0.0.0:123                 0.0.0.0:*                               858/ntpd            
    udp        0      0 fe80::1031:38ff:fe0:123     :::*                                    858/ntpd            
    udp        0      0 ::1:123                     :::*                                    858/ntpd  
    
  • mmigdol
    mmigdol almost 13 years
    From his netstat dump it does not appear that any Jetty processes are holding ports open...
  • Travis Nelson
    Travis Nelson almost 13 years
    True, his netstat says that Jetty is not holding the port, but I'd double check that Jetty isn't a stuck process.
  • David
    David almost 13 years
    @Travis Nelson - I think it was the version I was using I downgraded to 6.1.26 from jetty-hightide-7.4.5.v20110725, perhaps that version needs some special config. All is working fine with 6.1.26
  • IgorGanapolsky
    IgorGanapolsky over 10 years
    Even if I kill 859, it remains running.