# BackgrounDRb - uninitialized constant

**URL:** <https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894>\
**Category:** Rails\
**Created:** [July 26, 2006, 3:57am UTC](https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894 "2006-07-26T03:57:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![justin\_Pease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5e925/32.png) [@justin\_Pease](https://www.ruby-forum.com/u/justin_Pease)\
**Post date:** [July 26, 2006, 3:57am UTC](https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894/1 "2006-07-26T03:57:53Z")

</div>

I installed BackgrounDRB as instructed:

script/plugin install svn://rubyforge.org//var/svn/backgroundrb  
rake backgroundrb:setup

I started it with:  
rake backgroundrb:start

In a model I make the call:

MiddleMan.new\_worker :class =\> :rss\_worker

In /lib/workers I have file rss\_worker.rb, which contains the class:

Class RssWorker \< BackgrounDRb::Rails

def do\_work(args)  
…  
end  
end

It seems like I have everything setup right, but I get the following  
NameError:

uninitialized constant RssWorker

Any ideas? It’s probably something dumb, but I can’t seem to figure it  
out.

---

<div class="post-metadata">

**Author:** ![justin\_Pease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5e925/32.png) [@justin\_Pease](https://www.ruby-forum.com/u/justin_Pease)\
**Post date:** [July 26, 2006, 8:27am UTC](https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894/2 "2006-07-26T08:27:12Z")

</div>

On Jul 25, 2006, at 6:57 PM, justin Pease wrote:

> MiddleMan.new\_worker :class =\> :rss\_worker  
> It seems like I have everything setup right, but I get the following  
> NameError:
> 
> uninitialized constant RssWorker
> 
> Any ideas? It’s probably something dumb, but I can’t seem to  
> figure it  
> out.

Hey Justin-

```
Have you restarted the rb server since you put your worker class in

```

the lib dir? You have to restart the drb server to pick up new files  
you put in lib/workers. Oh actually now that I look at your code  
again I see that you have misspelled class as Class. Is this just a  
typo or is this also in your worker class code?

Class RssWorker \< BackgrounDRb::Rails

should be

class RssWorker \< BackgrounDRb::Rails

-Ezra

---

<div class="post-metadata">

**Author:** ![justin\_Pease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5e925/32.png) [@justin\_Pease](https://www.ruby-forum.com/u/justin_Pease)\
**Post date:** [July 26, 2006, 2:27pm UTC](https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894/3 "2006-07-26T14:27:26Z")

</div>

Ezra Z. wrote:

> Have you restarted the rb server since you put your worker class in  
> the lib dir?

I restarted webrick and also issued the commands

rake backgroundrb:stop  
rake backgroundrb:start

> again I see that you have misspelled class as Class. Is this just a  
> typo or is this also in your worker class code?

Woops. Yes, that is just a typo in the post. It is “class” in the  
code.

–

Justin

---

<div class="post-metadata">

**Author:** ![justin\_Pease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5e925/32.png) [@justin\_Pease](https://www.ruby-forum.com/u/justin_Pease)\
**Post date:** [July 26, 2006, 6:04pm UTC](https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894/4 "2006-07-26T18:04:24Z")

</div>

Ok. I had used:

rake backgroundrb:stop

and CTRL-C to kill my webrick.

Did this a bunch of times. Then I thought to check Activity Monitor -  
and sure enough, two Ruby instances were still alive! So I hand killed  
these, restarted everything - and the error went away.

---

<div class="post-metadata">

**Author:** ![justin\_Pease](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b5e925/32.png) [@justin\_Pease](https://www.ruby-forum.com/u/justin_Pease)\
**Post date:** [July 27, 2006, 3:16am UTC](https://www.ruby-forum.com/t/backgroundrb-uninitialized-constant/99894/5 "2006-07-27T03:16:27Z")

</div>

I have a similar problem trying to get BackgroundRb to work - the error  
message I get is

undefined method ‘start process’ for nil:NilClass

My install went ok but strangely this command didn’t work

script/backgroundrb/start -p 11111 -d

I get the error

start: invalid option: -p

So instead i’ve done

script/backgroundrb/start -d

which seems ok but when my controller calls my worker I get

undefined method ‘start process’ for nil:NilClass
