NoSuchMethodError ClassInjector UsingReflection isAvailable() Mockito

The error looks like this:

Caused by: java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker (alternate: null)
Caused by: java.lang.NoSuchMethodError: net.bytebuddy.dynamic.loading.ClassInjector$UsingReflection.isAvailable()Z

To solve the problem, you need to update the bytebuddy version to 1.9.3:

<dependency>
    <groupId>net.bytebuddy</groupId>
    <artifactId>byte-buddy</artifactId>
    <version>1.9.3</version>
    <scope>runtime</scope>
</dependency>

If the version update did not fix the error, you need to find the correct version of the dependency. Instructions are here: https://mchesnavsky.tech/determine-versions-of-dependencies-of-library-maven/

Telegram channel

If you still have any questions, feel free to ask me in the comments under this article or write me at promark33@gmail.com.

If I saved your day, you can support me 🤝

Leave a Reply

Your email address will not be published. Required fields are marked *