"Name or service not known" error on Webrick under JRuby

Working on a little tool for me in JRuby/Ruby I found a nasty message while trying to get up the Webrick HTTPServer:


[2009-03-26 22:53:56] INFO WEBrick 1.3.1
[2009-03-26 22:53:56] INFO ruby 1.8.6 (2009-03-16) [java]
[2009-03-26 22:53:56] WARN TCPServer Error: initialize: name or service not known
/home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:73:in `new': initialize: name or service not known (SocketError)
from /home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
from /home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:70:in `each'
from /home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
from /home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/server.rb:75:in `listen'
from /home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
from /home/dario/software/opt/jruby-1.2.0/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
from src/main.rb:26


After googling for a while, I didn't find anything about how to solve it. So, I gave a try to MRI, which throw me this trace:


[2009-03-26 22:48:24] INFO WEBrick 1.3.1
[2009-03-26 22:48:24] INFO ruby 1.8.7 (2008-08-11) [i686-linux]
[2009-03-26 22:48:24] WARN TCPServer Error: Permission denied - bind(2)
[2009-03-26 22:48:24] WARN TCPServer Error: Permission denied - bind(2)
/usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Permission denied - bind(2) (Errno::EACCES)
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `new'
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `each'
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen'
from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
from src/main.rb:26:in `new'
from src/main.rb:26


Ok, it wasn't that hard. I was trying to start up a server, which defaults to port 80, as non-privileged user under Linux.

Actually, it was a little headache but given the poor results found, I decided to report this to JRuby project as an improvement.


About this entry


0 comentarios: