java.lang.ClassNotFoundException: okio.ForwardingTimeout 已解决

这个问题发现是由于版本问题引起的,下面是我用的两个jar源码对比:
先看看okio-1.13.0.jar的,会发现在forwardingSource下面有ForwardingTimeout这个类
这里写图片描述
下面是okio-2.0.0.jar 包,会发现那个ForwardingTimeout没了,不知道官方改成什么了
这里写图片描述

我用okhttp-3.8.0.jar引用okio-2.0.0.jar的时候就会报

Exception in thread "main" java.lang.NoClassDefFoundError: okio/ForwardingTimeout
    at okhttp3.internal.http1.Http1Codec.newFixedLengthSink(Http1Codec.java:230)
    at okhttp3.internal.http1.Http1Codec.createRequestBody(Http1Codec.java:103)
    at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:60)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
    at okhttp3.RealCall.execute(RealCall.java:69)
    at com.test.httpclient.HttpClientUtil.postJson(HttpClientUtil.java:141)
    at com.test.httpclient.HttpClientUtil.main(HttpClientUtil.java:301)
Caused by: java.lang.ClassNotFoundException: okio.ForwardingTimeout
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 19 more

然后换到okio-1.13.0.jar,这个错误就没了,下面是提供这个jar的下载路径:
okio-1.13.0.jar下载链接

注意:okio-1.13.0.jar是com.squareup.okio的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值