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.

Samebug tips0

There are no available Samebug tips for this exception. If you know how to solve this issue, help other users by writing a short tip.

Don't give up yet. Paste your full stack trace to get a solution.

Solutions on the web10

  • 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.
  • 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.
  • Cannot create mock for class com.artsquare.studio.domain.digitization.BookingPromo. Mocking of non-interface types requires the CGLIB library. Please put cglib-nodep-2.2 or higher on the class path.
  • Stack trace

    • 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(ProxyBasedMockFactory.java:52) at org.spockframework.mock.runtime.JavaMockFactory.create(JavaMockFactory.java:51) at org.spockframework.mock.runtime.CompositeMockFactory.create(CompositeMockFactory.java:44) at org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:45) at org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:281) at org.spockframework.lang.SpecInternals.MockImpl(SpecInternals.java:83)

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    Unknown user
    Once, 1 year ago
    2 times, 4 months ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    4 times, 1 month ago