JUnits do not work after adding groovy facet.

I have a few junits extending from Spring' AbstractTransactionalSpringContextTests and generally doing some Hibernating. Now, the tests work if groovy facet is not configured. When I configure groovy facet tests fail to initilaize I get

java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer

Note, I do not have to run GroovyTestCase to run into this trouble, just the fact that I configured groovy facet will do.

This smells like a bug to me. WDYGT? Is there any workaround to get this working - besides removing groovy facet?

This is with IDEA 8.1.2 build 9852. I checked it with groovy version 1.5.7, 1.6.3 and some in betweeen all behave the
same way.

Thanks,
Alex.

0

Groovy facet also adds Groovy SDK to your module libraries. Seems that
they have CGLIB version incompatible with the Spring/Hibernate's one.
You can try to tweak your module classpath order or to separate Groovy
from other libraries.

0
Avatar
Permanently deleted user

"or separate Groovy from other libraries"

what exactly do you mean by this ?

BTW, I tried to re-order libraries but it did not do much. I also tried to use embedded groovy and it partially helped - my test is running - but now groovy script does not work. I get

Caught: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V

This is quite odd :-( Any more ideas?

Thanks,
alex.

0

That's not odd. Welcome to the classpath hell ;). I'm afraid the only
way out is either to move Groovy files to another module with another
classpath, or to change your Spring/Hibernate libraries' versions so
that they use the same CGLIB version as Groovy does.

0
Avatar
Permanently deleted user

Usually, the best way to avoid classpath problems with Groovy is to use groovy-all.jar. Is that what you mean by "embedded Groovy"?

0
Avatar
Permanently deleted user

Yep.

groovy facet tried to automagically detect where my groovy is. It found the location and put the jars in its lib directory as facet's libs. I changed that to point to just one jar (groovy-all) in embedded directory. But as I mentioned this only solves the problem of running the tests (they are totally groovy free). Now, I can not run groovy scripts that sit in the same module.

0

Which problems do you have with running groovy scripts?

0
Avatar
Permanently deleted user

you probably missed this:

BTW, I tried to re-order libraries but it did not do much. I also tried to use embedded groovy and it partially helped - my test is running - but now groovy script does not work. I get


Caught: java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)V

0

Oh no, the answer is the same. Your groovy*.jar is anyway compiled
against another version of CGLIB, so it's still classpath hell, sorry.

0

请先登录再写评论。