uninitialized constant Mongo::InvalidStringEncoding

50 views
Skip to first unread message

Alexandre Bini

unread,
Dec 6, 2009, 12:20:50 PM12/6/09
to MongoMapper
I updated now the mongoMapper gem, but my app doesn't start:

# script/server
=> Booting Mongrel
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/
dependencies.rb:440:in `load_missing_constant': uninitialized constant
Mongo::InvalidStringEncoding (NameError)
from /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/
dependencies.rb:80:in `const_missing'

Can you help me?

Alexandre Bini

unread,
Dec 6, 2009, 12:32:33 PM12/6/09
to MongoMapper
I think it's because mongo_ext gem. When i uninstalled it's works.




--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en



--
Alexandre Bini
fone: 18 3641-4382
site: www.voraz.com.br
blog da voraz: http://blog.voraz.com.br

blog pessoal: www.alexandrebini.com
msn: alex...@voraz.com.br
gtalk: alexan...@gmail.com
skype: voraz.com.br
Rua Americana, 104, Birigui-SP

Travis Bell

unread,
Dec 6, 2009, 12:42:15 PM12/6/09
to mongo...@googlegroups.com
Did you update the mongo gem to 0.18.1?

I ran into this issue when I did, but since I needed to get back to work so I downgraded for now (0.18 works fine with 0.6.6). I think John just has to update the gem for the new 0.18.1 gem.


Cheers,

--
Travis Bell






Aron Pilhofer

unread,
Dec 6, 2009, 2:15:09 PM12/6/09
to MongoMapper
I had this same problem yesterday. I updated all my mongo-related
gems, and then uninstalled all the old versions and magically
everything worked again.

On Dec 6, 12:32 pm, Alexandre Bini <alexandreb...@gmail.com> wrote:
> I think it's because mongo_ext gem. When i uninstalled it's works.
>
> On Sun, Dec 6, 2009 at 3:20 PM, Alexandre Bini <alexandreb...@gmail.com>wrote:
>
>
>
> > I updated now the mongoMapper gem, but my app doesn't start:
>
> > # script/server
> > => Booting Mongrel
> > => Rails 2.3.5 application starting onhttp://0.0.0.0:3000
> > /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/
> > dependencies.rb:440:in `load_missing_constant': uninitialized constant
> > Mongo::InvalidStringEncoding (NameError)
> >        from /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/
> > dependencies.rb:80:in `const_missing'
>
> > Can you help me?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "MongoMapper" group.
> > For more options, visit this group at
> >http://groups.google.com/group/mongomapper?hl=en?hl=en
>
> --
> Alexandre Bini
> fone: 18 3641-4382
> site:www.voraz.com.br
> blog da voraz:http://blog.voraz.com.br
>
> blog pessoal:www.alexandrebini.com
> msn: alexan...@voraz.com.br
> gtalk: alexandreb...@gmail.com

Benjamin Curtis

unread,
Dec 8, 2009, 1:50:55 PM12/8/09
to MongoMapper
It is a problem with mongo_ext -- I was getting the same error, then
uninstalled that and the error stopped.

Kevin Nuckolls

unread,
Dec 8, 2009, 1:40:27 PM12/8/09
to MongoMapper
I ran in to this problem as well. The solution was:

gem uninstall mongo_ext
gem install -v=0.18 mongo_ext

Stan

unread,
Dec 8, 2009, 5:32:41 PM12/8/09
to MongoMapper
In fact, it will work with version 0.18.1 . You just have to have only
this version for both mongo and mongo_ext.

I had mongo v0.18.1, v0.18 and mongo_ext v0.18.1 . On uninstall of
mongo v.0.18 - everything works.

I think that what happens is that mongo_mapper loads the first found
version of mongo lib and searches for the corresponding version of
mongo_ext.

David Lee

unread,
Dec 11, 2009, 1:38:29 AM12/11/09
to MongoMapper
I had a terrible time with this last night w/ bundler - thought it was
bundler rescuing LoadError and mongo needing to catch it, but that
turned out to be a red herring.

I got it working by being very explicit in my gemfile:

gem 'mongo', '= 0.18' # MUST BE THE **** SAME
gem 'mongo_ext', '= 0.18' # AS THIS
gem 'mongo_mapper', '= 0.6.6'

John Nunemaker

unread,
Dec 11, 2009, 12:54:06 PM12/11/09
to mongo...@googlegroups.com
Yeah. I removed the gem calls in the main mongo_mapper so people could
use it without rubyhema but that has made for some interesting
problems for people like this one.



On Dec 11, 2009, at 1:38 AM, David Lee <deathtoal...@gmail.com>
wrote:

Wojciech Piekutowski

unread,
Dec 11, 2009, 5:49:03 PM12/11/09
to mongomapper
2009/12/11 John Nunemaker <nune...@gmail.com>:
> Yeah. I removed the gem calls in the main mongo_mapper so people could
> use it without rubyhema but that has made for some interesting
> problems for people like this one.

Could you get them back and wrap them up more or less like this?

if self.class.const_defined? :Gem
gem ...
end

This will enable non-RubyGems users to use mongo_mapper while giving
less headache for the rest.

zmbmartin

unread,
Dec 29, 2009, 8:33:35 AM12/29/09
to MongoMapper
I am having this problem with mongomapper 0.6.8 and mongo 0.18.1 and
mongo_ext 0.18.1 If I uninstall mongo_ext things work I just get the
Notice C extensions not loaded. Here is the error that I am getting
when I try to run script/server.

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/


dependencies.rb:440:in `load_missing_constant': uninitialized constant

Mongo::InvalidDocument (NameError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:80:in `const_missing'


Thanks

Kyle Banker

unread,
Dec 29, 2009, 10:04:03 AM12/29/09
to mongo...@googlegroups.com
We've made some fixes to the Ruby driver that will be released in the next day or so. Until then, you can install the driver from master. Be sure to uninstall the current driver.

lancecarlson

unread,
Jan 4, 2010, 7:55:13 AM1/4/10
to MongoMapper
I'm having the same issue and I've installed the latest driver for
both mongo and mongo_ext. When I install mongo_ext, things start
working again. This is attempting to use the dm-mongo-adapter though.

lancecarlson

unread,
Jan 4, 2010, 8:02:49 AM1/4/10
to MongoMapper
when I uninstall mongo_ext I meant to say earlier.

Also, I tried downgrading both gems to 0.16 and it works fine.
Thoughts?

John Nunemaker

unread,
Jan 4, 2010, 8:31:07 AM1/4/10
to mongo...@googlegroups.com
It seems the driver is stricter about things when using the ext. I
found my problem was attempting to store an
ActiveSupport::TimeWithZone. It seems the pure ruby doesn't complain
as it just calls utc but the c ext has problems with it.

John Nunemaker

unread,
Jan 4, 2010, 8:32:06 AM1/4/10
to mongo...@googlegroups.com
Oh actually your issue is different versions of mongo and mongo_ext
gems. Gem install latest version of mongomapper and you should be fine.

On Jan 4, 2010, at 8:02 AM, lancecarlson <lancec...@gmail.com> wrote:

lancecarlson

unread,
Jan 4, 2010, 9:25:10 AM1/4/10
to MongoMapper
No, I had 0.18.1 of mongo and mongo_ext and 0.16 of both during my
tests.

On Jan 4, 8:32 am, John Nunemaker <nunema...@gmail.com> wrote:
> Oh actually your issue is different versions of mongo and mongo_ext  
> gems. Gem install latest version of mongomapper and you should be fine.
>

Kyle Banker

unread,
Jan 4, 2010, 10:12:09 AM1/4/10
to mongo...@googlegroups.com
can you just try uninstalling all versions of mongo and mongo_ext and then reinstalling 0.18.2?

Lance Carlson

unread,
Jan 4, 2010, 11:07:25 AM1/4/10
to mongo...@googlegroups.com
Got it working. I just added the adapter and mongo to the rails config
and it started working.
Reply all
Reply to author
Forward
0 new messages