org.spockframework.mock.CannotCreateMockException: Cannot create mock for class Collaborator. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.

GitHub | loesak | 1 month ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    existance check of cglib versions greater than 2.2.2 fails

    GitHub | 1 month ago | loesak
    org.spockframework.mock.CannotCreateMockException: Cannot create mock for class Collaborator. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.
  2. 0

    Chapter 7: testcase on page 160 doesn't work on GGTS3.6.0/Grails2.4.2

    manning.com | 9 months ago
    org.spockframework.mock.CannotCreateMockException: Cannot create mock for class com.grailsinaction.PostService. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.
  3. 0

    GitHub comment 686#273611515

    GitHub | 1 month ago | loesak
    org.spockframework.mock.CannotCreateMockException: Cannot create mock for class Collaborator. Mocking of non-interface types requires a code generation library. Please put byte-buddy-1.4.0 or cglib-nodep-3.2 or higher on the class path.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Cannot create mock for class LoginService. Mocking of non-interface types requires the CGLIB library..?

    Stack Overflow | 3 years ago | shy dildo
    org.spockframework.mock.CannotCreateMockException: Cannot create mock for class com.zee.LoginService. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.
  6. 0

    classcast exception with grails 2.2.3 and spock 0.7

    Stack Overflow | 4 years ago | Vineel Nalla
    java.lang.ClassCastException: com.grails.User cannot be cast to net.sf.cglib.proxy.Factory

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.spockframework.mock.CannotCreateMockException

      Cannot create mock for class Collaborator. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.

      at org.spockframework.mock.runtime.ProxyBasedMockFactory.create()
    2. Spock Framework - Core Module
      SpecInternals.MockImpl
      1. org.spockframework.mock.runtime.ProxyBasedMockFactory.create(ProxyBasedMockFactory.java:52)
      2. org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:51)
      3. org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44)
      4. org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:45)
      5. org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:281)
      6. org.spockframework.lang.SpecInternals.MockImpl(SpecInternals.java:83)
      6 frames