Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jetty Startup Fails - Address in Use

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  
like image 859
David Avatar asked Aug 16 '11 17:08

David


2 Answers

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
like image 196
Travis Nelson Avatar answered Nov 15 '22 13:11

Travis Nelson


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

like image 21
Jon Cohen Avatar answered Nov 15 '22 15:11

Jon Cohen