Mock from (Groovy) class - How?

150 views
Skip to first unread message

Pete

unread,
Nov 2, 2010, 5:34:18 PM11/2/10
to Spock Framework - User
I tried to create a mock from a class (tried Java and Groovy) and got:

java.lang.NoClassDefFoundError: org/objectweb/asm/Type
at net.sf.cglib.core.TypeUtils.parseType(TypeUtils.java:180)
at net.sf.cglib.core.KeyFactory.<clinit>(KeyFactory.java:66)
at net.sf.cglib.proxy.Enhancer.<clinit>(Enhancer.java:69)
at
org.spockframework.mock.DefaultMockFactory.create(DefaultMockFactory.java:
58)
at org.spockframework.mock.MockController.create(MockController.java:
63)
at spock.lang.Specification.Mock(Specification.java:240)
at HelloSpock.setup(HelloSpock.groovy:4)
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.Type
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more

I'm running in Eclipse. I downloaded cglib-nodep-2.2.jar and put it in
the classpath.
Any suggestions?

Peter Niederwieser

unread,
Nov 2, 2010, 8:49:36 PM11/2/10
to spockfr...@googlegroups.com
Hi Pete,

looks like you have another version of cglib on the classpath. Unlike cglib-nodep, this other version doesn't bundle (a shaded version of) asm, and hence asm is missing. So either you add the correct asm dependency for that other version of cglib, or (preferably) you remove the other version of cglib. For more information, google for "cglib java.lang.NoClassDefFoundError: org/objectweb/asm/Type".

Cheers,
Peter

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To post to this group, send email to spockfr...@googlegroups.com.
To unsubscribe from this group, send email to spockframewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spockframework?hl=en.


----------------------------------------------------------------
Peter Niederwieser
Twitter: pniederw









Pete

unread,
Nov 3, 2010, 3:02:24 AM11/3/10
to Spock Framework - User
Thanks for the pointer. I had downloaded cglib-2.2.jar by mistake.
> pnied...@gmail.com
> Twitter: pniederw
Reply all
Reply to author
Forward
0 new messages