Web3j: NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType)'

Created on 30 Sep 2020  路  6Comments  路  Source: web3j/web3j

Hello

When I run Web3j.build(HttpService("https://ropsten.infura.io/$id")).web3ClientVersion().send()

Therer is an error

java.lang.NoSuchMethodError: 'okhttp3.RequestBody okhttp3.RequestBody.create(java.lang.String, okhttp3.MediaType)'

Inside HttpService and performIO I see

RequestBody.create(request, JSON_MEDIA_TYPE);

Is wrong

It should be

RequestBody.create(JSON_MEDIA_TYPE, request);

Screenshot 2020-09-30 02:42:51

Environment

Kotlin 1.4.0
Quarkus 1.8.1.Final
Web3j 5.0.0

bug

Most helpful comment

Fixed: Manually adding the okhttp3 dependency will fix it!

All 6 comments

please use 4.6.3 which is the actual current latest lol - web3j 5.0.0 is on the way...

I encountered the same problem java.lang.NoSuchMethodError: okhttp3.RequestBody.create(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;;
when I use web3j-4.6.3 and run Web3ClientVersion clientVersion = web3.web3ClientVersion().send();

Is there any solution?

Still running into this issue, I am using Ganache. Will test with Geth when it's sync'd.

I encountered the same problem _java.lang.NoSuchMethodError: okhttp3.RequestBody.create(Ljava/lang/String;Lokhttp3/MediaType;)Lokhttp3/RequestBody;_;
when I use web3j-4.6.3 and run Web3ClientVersion clientVersion = web3.web3ClientVersion().send();

Is there any solution?

Did you manage to fix it?

Fixed: Manually adding the okhttp3 dependency will fix it!

Fixed: Manually adding the okhttp3 dependency will fix it!

thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FDN73 picture FDN73  路  4Comments

kalekale picture kalekale  路  8Comments

parcool picture parcool  路  6Comments

ligi picture ligi  路  3Comments

s1r-mar71n picture s1r-mar71n  路  5Comments