JodaTime and JRuby - java.lang.NoSuchMethodError: org.joda.time.DateTime.<init>(IIIIII)V

Hi

I have a problem using the joda time library together with JRuby
(1.6.6 and 1.6.5).
It looks like we are using the same version of the library as JRuby
uses (version 2.0 -
https://github.com/jruby/jruby/tree/master/build_lib)

I’ve written a failing test - https://github.com/andreasronge/joda_jruby

The JUnit tests works (using JavaEmbedUtils.newRuntimeAdapter()) but
calling it from JRuby fails:

ruby jrubytest.rb
NativeException: java.lang.NoSuchMethodError:
org.joda.time.DateTime.(IIIIII)V
(root) at jrubytest.rb:4

Cheers
Andreas

Seems like this should work. Probably a classloader conflict of some
sort? I’d say file a bug.

Thanks,
/Nick

1.6.5 and 1.6.6 ship with joda time 1.6.2 (although I thought jruby used
to
jarjar it to a different namespace?)

DateTime didn’t have the constructor that you’re trying to call in your
test code added until version 2.0. Therefore, the 1.6.2 version of the
code
is earlier in the classpath and gets loaded by the classloader.

Your code works with jruby-head though, which is bundling joda-time 2.0.

Cheers,

James

Hi

Thanks, I’m happy with that good explanation.
Luckily I have access to the source code using the joda library - I
can use another constructor instead.

Cheers
Andreas

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs