Problem using Ruby classes from within a monkey patched Java class

Infrequently we’re seeing this exception from one of our runtimes
(never all of them):

wrong number of arguments (1 for 0)

file:/usr/local/jboss-4.0.5-cluster/server/node1/tmp/deploy/tmp31413mmh.ear-contents/mmh-web-mvn-1.18.0-SNAPSHOT-exp.war/WEB-INF/lib/jruby-complete-1.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:42:in
`method_missing’

vendor/rails/activesupport/lib/active_support/dependencies.rb:124:in
`qualified_const_defined?’

vendor/rails/activesupport/lib/active_support/dependencies.rb:122:in
`each’

vendor/rails/activesupport/lib/active_support/dependencies.rb:122:in
`inject’

vendor/rails/activesupport/lib/active_support/dependencies.rb:122:in
`qualified_const_defined?’

vendor/rails/activesupport/lib/active_support/dependencies.rb:236:in
`load_missing_constant’

vendor/rails/activesupport/lib/active_support/dependencies.rb:469:in
`const_missing’

The class that this exception is thrown out of is a Java class with a
JRuby monkey patch, like this:

import com.foo.JavaModel
require ‘ruby_service’

class JavaModel
def call_service
RubyService.hello #exception happens here when it can’t find
RubyService
end
end

And that appears to work most of the time.

I took a look at the ‘qualified_const_defined?’ method in
dependencies.rb. It tries to call ‘Object.const_get constant_name’,
which doesn’t appear to be supported by java.rb

Any help would be appreciated.

Thanks,

-Tyler


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email