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

392 views
Skip to first unread message

Andreas Ronge

unread,
Feb 6, 2012, 9:25:14 AM2/6/12
to us...@jruby.codehaus.org
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.<init>(IIIIII)V
(root) at jrubytest.rb:4

Cheers
Andreas

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Nick Sieger

unread,
Feb 6, 2012, 1:23:27 PM2/6/12
to us...@jruby.codehaus.org
Seems like this should work. Probably a classloader conflict of some
sort? I'd say file a bug.

Thanks,
/Nick

James Abley

unread,
Feb 6, 2012, 5:40:45 PM2/6/12
to us...@jruby.codehaus.org
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

Andreas Ronge

unread,
Feb 7, 2012, 3:21:52 AM2/7/12
to us...@jruby.codehaus.org
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

Reply all
Reply to author
Forward
0 new messages