scott.hodson.blog

November 11, 2007

WEBrick won’t start on Windows

Filed under: Rails, Ruby — scott @ 9:35 pm

If you get a strange error trying to start WEBrick on Windows like this…


[2007-11-11 20:23:42] INFO WEBrick 1.3.1
[2007-11-11 20:23:42] INFO ruby 1.8.6 (2007-03-13) [i386-mswin32]
[2007-11-11 20:23:42] WARN TCPServer Error: Bad file descriptor - bind(2)
c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Bad file descriptor - bind(2) (Errno::EBADF)
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `new'
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `each'
from c:/bin/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
from c:/bin/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen'
from c:/bin/ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
from c:/bin/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:58:in `new'
... 7 levels...
from c:/bin/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39
from c:/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from c:/bin/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3

This is most likely caused by some other already listening on the default port 3000. Perhaps you have another WEBrick server instance running. To see if you have another app running on that port you can run

netstat -a -b

To show the list of applications and what ports they are listening on. If you want to release the port just kill the application listening on that port, or you can run WEBrick on another port like 8080 like this:

ruby script/server -p8080

References:

June 16, 2007

Netbeans 6: A Rails IDE? Part 1

Filed under: NetBeans, Rails, Ruby — scott @ 5:36 pm

So I downloaded the M9 pre-release of NetBeans 6.0 to preview for Ruby/Rails development. WAIT!

NetBeans? Ruby? I haven’t used NetBeans forever. I remember using some 4.x version for J2EE stuff years back but it was a giant and slow hairball. So I switched to Eclipse like most Java developers, then upgraded to IntelliJ for a few extra bucks and never looked back. So my initial response at the thought of using NetBeans for Rails development was one of thoughts of waiting, sludgy response times and buggy IDE responsiveness. Being greeted with a 166MB download (get the “Full” version) didn’t help to assuage my fears of history repeating itself. After downloading, extracting, installing, and then launching for the first time (10-15 minutes later) it came up and I immediately went to create a new Rails project. The process was quite painless and simple:

I would like some Rails please! Let’s build “depot”.

OK, fine, put it there, whatever

Hmm, it suggests that my rails may be out of date, let me go to a command-line and…oh wait, I’ll just press the button…voila!

Thanks, I was just thinking the other day that I needed that ActiveRecord-JDBC bridge (?). Actually, this is required if you plan to use Rails on JRuby, and if you’re using NetBeans you’re going to be encouraged to use JRuby if not forced (I’m not sure if it’s going to use my native Ruby runtime or JRuby, assuming it got installed).

OK, we’re up and running! Nice color coding, collapsible sections, some extraneous comments and some session management code thrown in I’m not use to Rails putting in there but NetBeans has done it for me.

And all of this only took up 125+MB of RAM!

Well, that’s all for now. I’ll spend some time actually developing with this and get back to you.

January 28, 2007

“Ruby School” In Session

Filed under: OCRuby, Ruby — scott @ 5:34 pm

Last week we had our first meeting of Ruby School. If you’re interested in learning more about Ruby and Rails, come to Ruby School.

Powered by WordPress