我真的很困惑这个错误。我不确定使用Java的过程是什么。做kill -9 <pid>
也无济于事。我试过重新安装jruby。我很难过。
[phoenix (master)]$ rvm use jruby
Using /Users/jess/.rvm/gems/jruby-9.0.0.0
[phoenix (master)]$ java.net.BindException: Address already in use
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:382)
at java.net.ServerSocket.bind(ServerSocket.java:375)
at java.net.ServerSocket.<init>(ServerSocket.java:237)
at java.net.ServerSocket.<init>(ServerSocket.java:128)
at com.martiansoftware.nailgun.NGServer.run(NGServer.java:411)
at java.lang.Thread.run(Thread.java:745)
[phoenix (master)]$ ps aux | grep java
jess 1197 0.0 0.4 4391504 29456 s000 S 2:01PM 0:00.95 /usr/bin/java -Xmx500m -Xss2048k -Djffi.boot.library.path=/Users/jess/.rvm/rubies/jruby-9.0.0.0/lib/jni -Dfile.encoding=UTF-8 -classpath /Users/jess/.rvm/rubies/jruby-9.0.0.0/lib/jruby.jar:/Users/jess/.rvm/rubies/jruby-9.0.0.0/lib/jruby-truffle.jar:/Users/jess/.rvm/rubies/jruby-9.0.0.0/lib/jruby-truffle.jar: -Djruby.home=/Users/jess/.rvm/rubies/jruby-9.0.0.0 -Djruby.lib=/Users/jess/.rvm/rubies/jruby-9.0.0.0/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.main.NailServerMain
jess 5365 0.0 0.0 2432772 648 s000 S+ 2:15PM 0:00.00 grep java
在杀死与java和jruby相关的进程后,我也经常遇到这个错误。
error: ng executable not found; run 'make' in /Users/jess/.rvm/rubies/jruby-9.0.0.0/tool/nailgun
更新
我是否需要更改此文件;如果是的话,怎么样?
[phoenix (master)]$ cat ~/.rvm/hooks/after_use_jruby
#!/usr/bin/env bash
\. "${rvm_path}/scripts/functions/hooks/jruby"
if [[ "${rvm_ruby_string}" =~ "jruby" ]]
then
jruby_ngserver_start
jruby_options_append "--ng" "${PROJECT_JRUBY_OPTS[@]}"
else
jruby_options_remove "--ng" "${PROJECT_JRUBY_OPTS[@]}"
jruby_clean_project_options
fi
答案 0 :(得分:3)
首先,JRuby当然使用Java,因为它是Ruby的Ruby实现。
在您的情况下,似乎您启动了Nailgun启动JRuby。 Nailgun是围绕Java的Ruby包装器,它加速了Java JVM的开始 - 另请参阅https://github.com/jruby/jruby/wiki/Improving-startup-time。 Nailgun启动一个服务器,它在端口2113上监听默认值。我的猜测就是问题出在哪里。也许另一个进程正在使用这个端口?
RVM实际上会尝试在rvm use jruby
之后自动启动Nailgun服务器。见~/.rvm/hooks/after_use_jruby
。您可以删除或更改此脚本以避免使用Nailgun。