Jruby.reify.classes raising error

Probably something silly i am doing, but i am trying to start jruby with
the jruby-reify.classes sys prop mentioned in this article:
http://www.engineyard.com/blog/2010/monitoring-memory-with-jruby-part-1-jhat-and-visualvm/

I execute:

/home/ubuntu/.rvm/rubies/jruby-head/bin/jruby
-J-Djruby.reify.classes=true --server -J-Xmx4096m
/home/ubuntu/.rvm/gems/jruby-head/bin/trinidad -f -e production >
log/trinidad.log 2>&1 &

And I get:

/home/ubuntu/.rvm/rubies/jruby-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require': load error: optparse -- java.lang.ClassFormatError: Duplicate method name&signature in class file ruby/OptionParser/Switch (LoadError) from /home/ubuntu/.rvm/rubies/jruby-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’
from
/home/ubuntu/.rvm/gems/jruby-head/gems/trinidad-1.0.2/bin/…/lib/trinidad/command_line_parser.rb:2
from
/home/ubuntu/.rvm/gems/jruby-head/gems/trinidad-1.0.2/bin/…/lib/trinidad/command_line_parser.rb:31:in
require' from /home/ubuntu/.rvm/rubies/jruby-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’
from
/home/ubuntu/.rvm/gems/jruby-head/gems/trinidad-1.0.2/bin/…/lib/trinidad.rb:15
from
/home/ubuntu/.rvm/gems/jruby-head/gems/trinidad-1.0.2/bin/…/lib/trinidad.rb:31:in
require' from /home/ubuntu/.rvm/rubies/jruby-head/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’
from
/home/ubuntu/.rvm/gems/jruby-head/gems/trinidad-1.0.2/bin/trinidad:6
from
/home/ubuntu/.rvm/gems/jruby-head/gems/trinidad-1.0.2/bin/trinidad:19:in
`load’
from /home/ubuntu/.rvm/gems/jruby-head/bin/trinidad:19

Any idea what i am doing wrong?

thx.

-karl

Update on this. I think this may be a trinidad issue or an issue with
the way i am starting trinidad as when i execute a simple ruby script,
it seems to work

jruby -J-Djruby.reify.classes=true --server -J-Xmx4096m test.rb

thx.

-karl

Copied from Trinidad’s users list:

Seems OptionParser doesn’t work fine with that option, I tried this
simple
example:

require ‘optparse’

options = OptionParser.new do |opt|

opt.on(“foo”) { puts “foo” }

opt.on(“bar”) { puts “bar” }

end

options.parse(ARGV)

And I’m getting this:

jruby -J-Djruby.reify.classes=true test.rb

test.rb:1:in `require’: load error: optparse –

java.lang.ClassCastException: ruby.OptionParser.OptionMap cannot be cast to
org.jruby.RubyHash (LoadError)

from test.rb:1

Just by requiring optparse, we get the error. Within test.rb:

require ‘optparse’

Then with debug level on:

karl:~ karl$ jruby -d -J-Djruby.reify.classes=true test.rb
java.lang.ClassFormatError: Duplicate method name&signature in class
file ruby/OptionParser/Switch
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
at
org.jruby.util.ClassCache$OneShotClassLoader.defineClass(ClassCache.java:68)
at org.jruby.RubyClass.reify(RubyClass.java:1354)
at org.jruby.RubyClass.reify(RubyClass.java:1142)
at org.jruby.RubyObject$2.reifyAncestors(RubyObject.java:187)
at org.jruby.RubyObject$2.reifyAncestors(RubyObject.java:186)
at org.jruby.RubyObject$2.allocate(RubyObject.java:180)
at org.jruby.RubyClass.allocate(RubyClass.java:215)
at org.jruby.RubyClass$SpecificArityNew.call(RubyClass.java:809)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)
at
org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:121)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:126)
at
org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
at
org.jruby.ast.AttrAssignTwoArgNode.interpret(AttrAssignTwoArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at
org.jruby.evaluator.ASTInterpreter.evalClassDefinitionBody(ASTInterpreter.java:199)
at org.jruby.ast.ClassNode.interpret(ClassNode.java:141)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.Ruby.runInterpreter(Ruby.java:715)
at org.jruby.Ruby.loadFile(Ruby.java:2559)
at org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:66)
at
org.jruby.runtime.load.LoadService.tryLoadingLibraryOrScript(LoadService.java:710)
at org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:318)
at org.jruby.runtime.load.LoadService.require(LoadService.java:365)
at
org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:290)
at org.jruby.RubyKernel.requireCommon(RubyKernel.java:1053)
at org.jruby.RubyKernel.require(RubyKernel.java:1036)
at
org.jruby.RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.call(org/jruby/RubyKernel$s_method_1_0$RUBYFRAMEDINVOKER$require.gen:65535)
at
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOneOrNBlock.call(JavaMethod.java:319)
at
org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:313)
at
org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:152)
at test.file(test.rb:1)
at test.load(test.rb)
at org.jruby.Ruby.runScript(Ruby.java:688)
at org.jruby.Ruby.runNormally(Ruby.java:571)
at org.jruby.Ruby.runFromMain(Ruby.java:414)
at org.jruby.Main.run(Main.java:304)
at org.jruby.Main.run(Main.java:144)
at org.jruby.Main.main(Main.java:113)
test.rb:1:in `require’: load error: optparse –
java.lang.ClassFormatError: Duplicate method name&signature in class
file ruby/OptionParser/Switch (LoadError)
from test.rb:1
karl:~ karl$

I am using

karl:~ karl$ jruby -v
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-11-24 6adabd0) (Java
HotSpot™ 64-Bit Server VM 1.6.0_20) [darwin-x86_64-java]

java version “1.6.0_20”
Java™ SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot™ 64-Bit Server VM (build 16.3-b01-279, mixed mode)

Guess i should open up an issue?

thx.

-karl

On Mon, Nov 29, 2010 at 7:50 PM, Karl B. [email protected] wrote:

at java.lang.ClassLoader.defineClass(ClassLoader.java:616)

org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:303)

at org.jruby.ast.ClassNode.interpret(ClassNode.java:141)
at org.jruby.runtime.load.LoadService.lockAndRequire(LoadService.java:290)
at test.load(test.rb)
karl:~ karl$

I am using
karl:~ karl$ jruby -v
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-11-24 6adabd0) (Java
HotSpot™ 64-Bit Server VM 1.6.0_20) [darwin-x86_64-java]
java version “1.6.0_20”
Java™ SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot™ 64-Bit Server VM (build 16.3-b01-279, mixed mode)
Guess i should open up an issue?

Please do. http://bugs.jruby.org/.

/Nick