Jruby Blues

Man today was one of those days, I am about to give up on Jruby. Don’t get me wrong I absolutely love the idea of Jruby, great way to sneak in Ruby into the enterprise. But I don’t think it is quite there yet.

If you want to use Jruby and Spring all you got do is include these dependencies into your pom file.


And it works great,……………as long as you don’t have to use Hibernate. It just so happens that Jruby uses asm-2.2.3.jar file and Hibernate uses asm-1.5.3 and apparently the api is very different between these two versions, result is

java.lang.NoSuchMethodError: net.sf.cglib.core.Signature.(Ljava/lang/String;Lnet/sf/cglib/asm/Type;[Lnet/sf/cglib/asm/Type ; ) V

Man this is frustrating, I spent all day trying to work around the problem but no go. Now here is the kicker, it works perfectly fine in eclipse and I am using maven 2 ide .

I spoke with my colleague (Tim) about this and he thinks it works because of OSGI which allows different jar’s depend on different versions of other jars.

One thought on “Jruby Blues

  1. Hi,

    the asm lib is a known issue with JRuby and Hibernate. This kind of trouble is in fact more a Java jar issue than a JRuby one and occurs frequently as soon as you integrate large frameworks together.

    Still, I don’t really understand why you get the issue (or may be it’s only in Maven?). Indeed, JRuby works arround that issue by repackaging asm.jar using the ‘jarjar’ tool. Thus, if you look inside jruby-complete.jar you’ll see that it’s repackaged into jruby.objectweb.asm … which is different from the asm of the Hibernate distro.

    So I don’t really understand why you are getting the problem since asm classes aren’t colliding anymore. Did you really use jruby-complete and jruby-complete only? Is it a Maven issue?

    I think you should really be able to work arround the problem: lot’s of others successfully used Hibernate in JRuby. There is even the ActiveHibernate lib wrapping Hibernate object better into Ruby objects:

    Hope this helps. You might also get help from the JRuby mailing list.

    Raphaë Valyi.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s