If I start mongrel the error will come. What can I do?
Tell me another way to start Mongrel please...
$script/server mongrel
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
Exiting
/usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize_without_backlog': Address already in use - bind(2) (Errno::EADDRINUSE)
from /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize'
from /usr/lib/ruby/1.8/mongrel.rb:93:in `new'
from /usr/lib/ruby/1.8/mongrel.rb:93:in `initialize'
from /usr/lib/ruby/1.8/mongrel/configurator.rb:139:in `new'
from /usr/lib/ruby/1.8/mongrel/configurator.rb:139:in `listener'
from /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_'
from /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `call'
from /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `initialize'
... 19 levels...
from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from script/server:3
thanks
kingston
The error means you have an other server already running on the port 3000. Either quit that server or start Mongrel on another port.
$ script/server mongrel -p 3001
I had this experience that when I start mongrel server and use Ctrl-C to shut down the mongrel server in ubuntu, the server will not shut down, and I wont be able to start the mongrel server in the same port until some time(or perhaps till a system restart). So, do not exit terminal while running a mongrel server. When you have to shut down the mongrel server, use Ctrl-Alt-C in ubuntu.
Related
Im trying to get started learning Ruby on Rails and I'm having an issue getting server to start or stop correctly and I'm not sure why.
As i understand it, when i start a server up it will run until i hit Ctrl + C to shut it down.
However if i run bin/rails server to start it up it says there is already a server running at port 3000 so i need to use a different port, which ive done below. I don't want to keep making new ports each time.
What am i doing wrong folks?
Gavins-MacBook-Pro:buro MacBook$ bin/rails server -p 3001
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3001
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check /Users/MacBook/buro/tmp/pids/server.pid.
Exiting
Gavins-MacBook-Pro:buro MacBook$
Gavins-MacBook-Pro:buro MacBook$ bin/rails server -p 3001
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3001
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check /Users/MacBook/buro/tmp/pids/server.pid.
Exiting
Gavins-MacBook-Pro:buro MacBook$ bin/rails server -p 3002
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3002
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
A server is already running. Check /Users/MacBook/buro/tmp/pids/server.pid.
Exiting
Gavins-MacBook-Pro:buro MacBook$
Also i tried removing the pid file but then i still get this:
Gavins-MacBook-Pro:buro MacBook$ bin/rails server
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-07-24 10:58:14] INFO WEBrick 1.3.1
[2015-07-24 10:58:14] INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin14]
Exiting
/Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/socket.rb:206:in `bind': Address already in use - bind(2) for 127.0.0.1:3000 (Errno::EADDRINUSE)
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/socket.rb:206:in `listen'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/socket.rb:461:in `block in tcp_server_sockets'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/socket.rb:232:in `each'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/socket.rb:232:in `foreach'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/socket.rb:459:in `tcp_server_sockets'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/utils.rb:70:in `create_listeners'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:133:in `listen'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/server.rb:114:in `initialize'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/webrick/httpserver.rb:45:in `initialize'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in `new'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:31:in `run'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:286:in `start'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:80:in `start'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from /Users/MacBook/buro/bin/rails:8:in `require'
from /Users/MacBook/buro/bin/rails:8:in `<top (required)>'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `load'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in `call'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:in `call'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client.rb:26:in `run'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/bin/spring:48:in `<top (required)>'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `load'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/MacBook/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/MacBook/buro/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
Do
ps ax | grep server
and look for your rails servers. The first number in each result line is the process id, aka "pid". You can kill these processes like
kill -9 12345
where 12345 is an example pid.
Kill them all and then do
rm tmp/pids/server.pid
for good measure. These are all done in Terminal by the way, in your application's root folder (where you run the server from).
https://www.railstutorial.org/book/beginning#sec-rails_server
I have reached this step, and I'm using the cloud9 environment. When I run the server as per Listing 1.7 on that tutorial, however, I get this error:
myname#rails-tutorial:~/workspace/hello_app $ rails server -p $PORT -b $IP
=> Booting WEBrick
=> Rails 4.2.0.beta2 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-10-30 21:44:22] INFO WEBrick 1.3.1
[2014-10-30 21:44:22] INFO ruby 2.1.1 (2014-02-24) [x86_64-linux]
Exiting /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:206:in `bind': Address already in use - bind(2) for 0.0.0.0:8080 (Errno::EADDRINUSE)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:206:in `listen'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:461:in `block in tcp_server_sockets'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:232:in `each'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:232:in `foreach'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/socket.rb:459:in `tcp_server_sockets'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/utils.rb:75:in `create_listeners'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:132:in `listen'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:113:in `initialize'
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:45:in `initialize'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:32:in `new'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/rack-1.6.0.beta/lib/rack/handler/webrick.rb:32:in `run'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/rack-1.6.0.beta/lib/rack/server.rb:288:in `start'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/railties-4.2.0.beta2/lib/rails/commands/server.rb:80:in `start'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
from /home/ubuntu/workspace/hello_app/bin/rails:8:in `require'
from /home/ubuntu/workspace/hello_app/bin/rails:8:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
from /usr/local/rvm/gems/ruby-2.1.1#rails4/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/ubuntu/workspace/hello_app/bin/spring:16:in `require'
from /home/ubuntu/workspace/hello_app/bin/spring:16:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
I've tried specifying a different port, but that doesn't work and the cloud9 environment suggests to me I should just use the $PORT variable.
The error "Address already in use - bind(2) for 0.0.0.0:8080 (Errno::EADDRINUSE)" implies that I already have a rails server running, but I don't. I'm not really sure what to do here and the tutorial doesn't suggest any method of troubleshooting this issue.
I learned that you can use the command killall ruby to stop any of the ruby processes which helped me because I had mistakenly run the rails server -b $IP -p $PORT command at the ~/workspace level in the tutorial. I found the answer in can't open rails server
I ended up starting the tutorial from scratch again and it worked fine, but anyone with this problem in the future may find this troubleshooting technique I received from cloud9's support team useful:
Try:
lsof -i:8080
This will give the app that occupies it.
If apache, stop it using:
sudo /etc/init.d/apache2 stop
Hope this answer is of use to anyone with this problem.
Probably you just had the other server still running. The one you initiate earlier on in he tutorial with the rails server command. You need to shut the other one down first using Ctrl+C, then try rails server -b $IP -p $PORT again
$ rails server -b $IP -p $PORT
Cloud9 uses the special environment variables $IP and $PORT to assign
the IP address and port number dynamically. If you want to see the
values of these variables, type echo $IP or echo $PORT at the command
line.
It's likely that if you wait a few minutes (not more than 2), your OS will free up the port. If not, use a random port number over about 5,000 every time you run rails server, e.g.
$ rails server -b $IP -p 6789
Or, because your IDE is so sucky, you might consider using a different IDE.
i am trying to install LibraryFind and i was successfull in many aspects until i reached the step where i have to run my application.
i enter the following command and i get these results.
r
oot#ubuntu:/home/administrator/Desktop/trunk# ruby script/server
=> Booting WEBrick...
=> Rails 2.2.2 application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2011-08-24 02:01:55] INFO WEBrick 1.3.1
[2011-08-24 02:01:55] INFO ruby 1.8.7 (2010-08-16) [i686-linux]
[2011-08-24 02:01:55] WARN TCPServer Error: Address already in use - bind(2)
/usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
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 /home/administrator/Desktop/trunk/vendor/rails/railties/lib/webrick_server.rb:56:in `new'
from /home/administrator/Desktop/trunk/vendor/rails/railties/lib/webrick_server.rb:56:in `dispatch'
from /home/administrator/Desktop/trunk/vendor/rails/railties/lib/commands/servers/webrick.rb:66
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /home/administrator/Desktop/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
from /home/administrator/Desktop/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /home/administrator/Desktop/trunk/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
from /home/administrator/Desktop/trunk/vendor/rails/railties/lib/commands/server.rb:49
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from script/server:3
it seems im either missing a library or i am having a problem in my configurat
There is another instance of webrick running of the port 3000. Use the command
ps aux | grep webrick
To verify it. And then kill it.
EDIT:
The ps command shows you a list of the current running programs of your machine. Each program on a unix-like machine comes with a PID number associated with it. In your case, the other running instance has a pid = 12288. So you can use:
kill 12288
To kill the other instance of the server.
I'm trying to create a very simple Hello, world program in RoR, but when I go to view the url http://localhost:3000/say/hello I'm getting the error message No route matches: "say/hello"
When I started the rails server I got this message with warnings scattered throughout:
=> Booting WEBrick
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-06-20 20:02:44] INFO WEBrick 1.3.1
[2011-06-20 20:02:44] INFO ruby 1.9.2 (2011-02-18) [i686-linux]
[2011-06-20 20:02:44] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:73:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:73:in `new'
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:73:in `block in create_listeners'
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:70:in `each'
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:70:in `create_listeners'
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:74:in `listen'
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:62:in `initialize'
from /home/eyedea/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:24:in `initialize'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/handler/webrick.rb:10:in `new'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/handler/webrick.rb:10:in `run'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.3/lib/rack/server.rb:217:in `start'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands/server.rb:65:in `start'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
from /home/eyedea/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.9/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I started with: rails generate controller Say hello goodbye
which lists route get "say/hello"
Also: I'm having this problem which is probably related. When I go to write some basic html in one of the files that is clearly listed as existing I get this:
I write this:
~/work/demo$ /app/views/say/hello.html.erb
Get this error message in return:
bash: /app/views/say/hello.html.erb: No such file or directory
What's going on here? I'm getting these instructions straight from Agile Development with Rails and it's so simple. I don't understand what's going on.
[2011-06-20 20:02:44] WARN TCPServer Error: Address already in use - bind(2)
You already have a server (or something) running on the port your server is supposed to be running on. As such, the code you think is running (which you say has the route in question) actually isn't running. Once you shut down the other process (probably a previously running rails server?), you can start the correct one and make sure it actually has that route.
The error you're getting at rails startup indicates that there is already a server running at port 3000 on your machine (and apparently that server knows nothing of a "say/hello" route). Shut that one down and try again.
The second error is because from bash the path / goes to the root directory. Try:
cat app/views/say/hello.html.erb
I am faced with a similar problem. In my case after $ rails server command I am unable to shut down the server using ctrl-C in the terminal itself. Nothing happens when I press ctrl-C in the terminal.
When I reopen the project on another terminal, and run it again I get the following message:
System-Product-Name:~/testapp$ rails s
=> Booting WEBrick
=> Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-06-30 16:41:23] INFO WEBrick 1.3.1
[2011-06-30 16:41:23] INFO ruby 1.9.2 (2011-02-18) [x86_64-linux]
[2011-06-30 16:41:23] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:73:in initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
ls.rb:73:innew'
from bubble/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:73:in block in create_listeners'
from bubble/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:70:ineach'
from bubble/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/utils.rb:70:in create_listeners'
from bubble/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:74:inlisten'
from bubble/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/server.rb:62:in initialize'
from bubble/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick/httpserver.rb:24:ininitialize'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/rack-1.3.0/lib/rack/handler/webrick.rb:10:in new'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/rack-1.3.0/lib/rack/handler/webrick.rb:10:inrun'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/rack-1.3.0/lib/rack/server.rb:265:in start'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/railties-3.1.0.rc4/lib/rails/commands/server.rb:70:instart'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:54:in block in <top (required)>'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:intap'
from bubble/.rvm/gems/ruby-1.9.2-p180#rails31/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in <top (required)>'
from script/rails:6:inrequire'
from script/rails:6:in `'
In essence I have to kill the process from system monitor everytime. Can this be cured?
On a mac, type the following in your terminal:
lsof | grep IPv4
or
lsof|grep 3000 in linux i think.
find the lione that starts with 'ruby' and note the number next to that.
let's say the number is 1234. type the following in you terminal:
kill -9 1234
and you should be right. Remember to exit out of WEBrick with control-c!
I'm trying to get started with Ruby on Rails, and it's all gone quite well up until I try to start the server. I get the following error:
C:\Users\Ken\workspace\railsHello>rails server
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-03-10 19:53:08] INFO WEBrick 1.3.1
[2011-03-10 19:53:08] INFO ruby 1.9.2 (2011-02-18) [i386-mingw32]
[2011-03-10 19:53:09] WARN TCPServer Error: not a socket file descriptor
Exiting
C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:73:in `initialize': not a socket file
descriptor (ArgumentError)
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:73:in `new'
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:73:in `block in create_l
isteners'
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:70:in `each'
from C:/Ruby192/lib/ruby/1.9.1/webrick/utils.rb:70:in `create_listeners'
from C:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:74:in `listen'
from C:/Ruby192/lib/ruby/1.9.1/webrick/server.rb:62:in `initialize'
from C:/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:24:in `initialize'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/web
rick.rb:10:in `new'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/handler/web
rick.rb:10:in `run'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/rack-1.2.1/lib/rack/server.rb:2
13:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds/server.rb:65:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds.rb:30:in `block in <top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds.rb:27:in `tap'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5/lib/rails/comman
ds.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
C:\Users\Ken\workspace\railsHello>
I don't even know where to start with "TCPServer Error: Not a socket file descriptor."
Trying it through Aptana didn't help either.
I'm on Windows 7 Home Premium. Apache was already installed, but I shut it down and it didn't make a difference.
Thanks in advance for your help!
-Ken
Are you sure nothing else is listening on port 3000 (perhaps an old instance of the server that didn't get shut down)? Check the following:
netstat -a -b
If there is, simply kill that application, or start WEBrick on another port; for example, to start it on port 8000:
rails server --port=8000