【问题标题】:Jetty Startup Fails - Address in UseJetty 启动失败 - 地址在使用中
【发布时间】:2011-08-16 17:37:03
【问题描述】:

我最近在 Amazon Ec2 上尝试了 jetty;当我尝试开始时;我收到“地址已在使用”错误。

我确定此系统上没有其他服务器正在运行。

我什至尝试将端口更改为 8080 到 8090 以外的其他端口

还是一样的。

这里是堆栈跟踪。任何想法如何解决?

2011-08-16 17:22:14.722:WARN::FAILED SelectChannelConnector@10.122.219.58: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

这是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  

【问题讨论】:

    标签: amazon-ec2 jetty


    【解决方案1】:

    您可能需要终止该进程。运行ps -ef|grep jetty 获取进程号,然后将其杀死。确保你杀死了正在运行应用服务器的进程(859 是我机器上的进程号)。

    $ 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
    

    【讨论】:

    • 从他的 netstat 转储中,似乎没有任何 Jetty 进程保持端口打开...
    • 没错,他的 netstat 说 Jetty 没有持有端口,但我会仔细检查 Jetty 不是卡住的进程。
    • @Travis Nelson - 我认为这是我使用的版本,我从 jetty-hightide-7.4.5.v20110725 降级到 6.1.26,也许该版本需要一些特殊配置。 6.1.26 一切正常
    • 即使我杀死了 859,它仍然在运行。
    【解决方案2】:

    检查您没有两次引用jetty-ssl.xml

    【讨论】:

      【解决方案3】:

      当我为 start.jar 提供我自己的配置时遇到了这个问题,但我将 start.ini 留在了码头根文件夹中。这使得部署了一些我没有缩进的额外测试内容。从 Jetty 目录中删除 start.ini 文件解决了这个问题。

      【讨论】:

        猜你喜欢
        • 2021-10-02
        • 1970-01-01
        • 1970-01-01
        • 2020-03-20
        • 2020-11-13
        • 2017-04-21
        • 1970-01-01
        • 1970-01-01
        • 2019-07-26
        相关资源
        最近更新 更多