eventmachine/eventmachine — Issue #285: NameError with JRuby (possible fix included)
Author: opiskelijarekisteri-devel
Created: 2011-12-18 10:40:31+00:00
State: open

Hello,

with eventmachine (1.0.0.beta.4 java), jruby-1.6.5 and options

```
JRUBY_OPTS=--1.9 -J-Djruby.thread.pooling=true -J-Djruby.compile.mode=FORCE -J-Djruby.management.enabled=false --server --fast
```

eventmachine gives the following error:

```
NameError: wrong constant name const_get
const_get at org/jruby/RubyModule.java:2526
EventMachine at
/home/dmd/.rvm/gems/jruby-1.6.5@organisations/gems/eventmachine-1.0.0.beta.4-java/lib/eventmachine.rb:90
each at org/jruby/RubyArray.java:1612
inject at org/jruby/RubyEnumerable.java:830
EventMachine at
/home/dmd/.rvm/gems/jruby-1.6.5@organisations/gems/eventmachine-1.0.0.beta.4-java/lib/eventmachine.rb:89
(root) at
/home/dmd/.rvm/gems/jruby-1.6.5@organisations/gems/eventmachine-1.0.0.beta.4-java/lib/eventmachine.rb:72
require at org/jruby/RubyKernel.java:1047
require at
/home/dmd/.rvm/rubies/jruby-1.6.5/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
(root) at
/home/dmd/.rvm/gems/jruby-1.6.5@organisations/gems/dnode-0.0.2/lib/dnode.rb:1
require at org/jruby/RubyKernel.java:1047
require at
/home/dmd/.rvm/rubies/jruby-1.6.5/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59
(root) at ./dnode_server.rb:3
```

However, it seems to work fine with the following fix:

```
# System errnos
# @private
ERRNOS = Errno::constants.grep(/^E/).inject(Hash.new(:unknown)) { |hash,
name|
#errno = Errno.__send__(:const_get, name)
errno = Errno.const_get(name)
hash[errno::Errno] = errno
hash
}
```

Thanks.