Устранение проблемы зависимости с исключением okhttp MethodNotFound Exception
Я получаю эту ошибку:
java.lang.NoSuchMethodError: okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody;
2021-02-17 19:13:16,585 ERROR [http-nio-8085-exec-2] org.apache.juli.logging.DirectJDKLog (DirectJDKLog.java:175): Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody;] with root cause
java.lang.NoSuchMethodError: okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody;
Зависимость для
org.apache.juli.logging.DirectJDKLog
обеспечивается пружинным пыльником.
Я попытался откатить версию с пружинной загрузкой, но это не помогло.
Spring Boot (старый и новый 2.4.2) используют эту зависимость в своем файле POM.
file: spring-boot-starter-logging-2.3.3.RELEASE.pom
the 2.4.1 file has the same dependency.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.7.30</version>
<scope>compile</scope>
</dependency>
Кажется, это проблема даже с последними версиями okhttp3.
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.9</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.14.9</version>
</dependency>
При выполнении журнала метод не найден.