mailjet-apiv3-java icon indicating copy to clipboard operation
mailjet-apiv3-java copied to clipboard

java.lang.NoSuchMethodError: 'okio.Buffer okio.BufferedSource.getBuffer()'

Open stefanbethke opened this issue 3 years ago • 2 comments

In a large Spring Boot based application, I'm getting this error.

java.lang.NoSuchMethodError: 'okio.Buffer okio.BufferedSource.getBuffer()'
	at okhttp3.internal.connection.RealConnection.createTunnel(RealConnection.java:411)
	at okhttp3.internal.connection.RealConnection.connectTunnel(RealConnection.java:236)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:177)
	at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
	at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
	at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
	at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
	at okhttp3.RealCall.execute(RealCall.java:81)
	at com.mailjet.client.MailjetClient.post(MailjetClient.java:131)

I've found one hit for this error, but the suggestion to update to okio.1.16.0 did not change anything.

Maven shows me these dependencies:

[INFO] \- com.mailjet:mailjet-client:jar:5.2.0:compile
[INFO]    +- com.squareup.okhttp3:okhttp:jar:3.14.9:compile
[INFO]    |  \- com.squareup.okio:okio:jar:1.15.0:compile
[INFO]    \- org.json:json:jar:20140107:compile

I notice that okhttp:3.14.9 is over two years old, the most recent current version appears to be 4.9.3. I have a suspicion that this might have something to do with it.

stefanbethke avatar Jun 13 '22 07:06 stefanbethke

It might also be worthwile to consider simply using the JDK HTTP client instead.

stefanbethke avatar Jun 13 '22 07:06 stefanbethke

@stefanbethke , thanks for raising this issue! Sorry for the late reply. All dependencies have been updated to the latest in the 5.2.1 release. Does it resolve the issue?

szagr avatar Aug 28 '22 14:08 szagr